C# Class StringUtils, GPUNoiseForUnity

Afficher le fichier Open project: heyx3/GPUNoiseForUnity Class Usage Examples

Méthodes publiques

Méthode Description
FixDirectorySeparators ( string path ) : string

Replaces all directory separators with the correct one for the current platform (either / or \).

GetRelativePath ( string fullPath, string startFolder ) : string

Turns the given full path into a relative one starting just above the given directory. For example, "GetRelativePath("C:/A/B/C", "B")" returns "B/C". Returns "null" if the given folder can't be found.

As a side effect, all '/' or '\' slashes will be changed to the correct directory separator char for this platform.

IncrementNumberPostfix ( string str ) : string

If the given string ends in a number, increments that number. Otherwise, appends a "2" to it.

PrettifyVarName ( string name ) : string

Turns the given variable name into a nice display name.

RemoveEverythingBefore ( this str, char c ) : string

Finds the last instance of the given char and removes it along with everything that came before it.

ToCodeString ( this f ) : string

Gets this float as a code-parseable string. In other words, if this float's default string representation is scientific notation, this method automatically fixes that.

Method Details

FixDirectorySeparators() public static méthode

Replaces all directory separators with the correct one for the current platform (either / or \).
public static FixDirectorySeparators ( string path ) : string
path string
Résultat string

GetRelativePath() public static méthode

Turns the given full path into a relative one starting just above the given directory. For example, "GetRelativePath("C:/A/B/C", "B")" returns "B/C". Returns "null" if the given folder can't be found.
As a side effect, all '/' or '\' slashes will be changed to the correct directory separator char for this platform.
public static GetRelativePath ( string fullPath, string startFolder ) : string
fullPath string
startFolder string /// The folder that will appear at the top of the returned path. ///
Résultat string

IncrementNumberPostfix() public static méthode

If the given string ends in a number, increments that number. Otherwise, appends a "2" to it.
public static IncrementNumberPostfix ( string str ) : string
str string
Résultat string

PrettifyVarName() public static méthode

Turns the given variable name into a nice display name.
public static PrettifyVarName ( string name ) : string
name string
Résultat string

RemoveEverythingBefore() public static méthode

Finds the last instance of the given char and removes it along with everything that came before it.
public static RemoveEverythingBefore ( this str, char c ) : string
str this
c char
Résultat string

ToCodeString() public static méthode

Gets this float as a code-parseable string. In other words, if this float's default string representation is scientific notation, this method automatically fixes that.
public static ToCodeString ( this f ) : string
f this
Résultat string