C# Class StringUtils, GPUNoiseForUnity

Datei anzeigen Open project: heyx3/GPUNoiseForUnity Class Usage Examples

Public Methods

Method 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 method

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

GetRelativePath() public static method

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. ///
return string

IncrementNumberPostfix() public static method

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
return string

PrettifyVarName() public static method

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

RemoveEverythingBefore() public static method

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
return string

ToCodeString() public static method

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
return string