C# Класс StringUtils, GPUNoiseForUnity

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

FixDirectorySeparators() публичный статический Метод

Replaces all directory separators with the correct one for the current platform (either / or \).
public static FixDirectorySeparators ( string path ) : string
path string
Результат string

GetRelativePath() публичный статический Метод

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. ///
Результат string

IncrementNumberPostfix() публичный статический Метод

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
Результат string

PrettifyVarName() публичный статический Метод

Turns the given variable name into a nice display name.
public static PrettifyVarName ( string name ) : string
name string
Результат string

RemoveEverythingBefore() публичный статический Метод

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
Результат string

ToCodeString() публичный статический Метод

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
Результат string