Namespace: DuString

DuString

JavaScript String related methods

Methods

staticDuString.args(string, args){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4597
Replaces all occurences of "{#}" in the string by the args.
Name Type Description
string string The original string
args Array.<string> | string The arguments
Returns:
Type Description
string The new string

staticDuString.endsWith(str, suffix){bool}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4620
Checks if a string ends with a given suffix
Name Type Description
str string The string to check
suffix string The suffix
Returns:
Type Description
bool Whether the string ends with the given suffix or not

staticDuString.fromSize(size){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4735
Converts a size in Bytes to a human-readable string with a fitting unit automatically chosen
Note that the conversion uses 1024 Bytes per kB.
Name Type Description
size int The size in Bytes
Returns:
Type Description
string The stringified size

staticDuString.fullTrim(str){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4723
Returns a copy of the string without leading and trailing white spaces, and without any new line, leaving only standard spaces.
Name Type Description
str string The string to trim
Returns:
Type Description
String The trimmed string

staticDuString.generateUnique(newString, stringList, increment, isFile){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4633
Generates a new unique string (numbered)
Name Type Default Description
newString string The wanted new string
stringList Array.<string> The list of strings where the new one must be generateUnique
increment boolean true optional true to automatically increment the new name if it already ends with a digit
isFile boolean false optional when generating name for files, setting this to true will add the increment before the extension
Returns:
Type Description
string The unique string, with a new number at the end if needed.

staticDuString.leftTrim(str){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4703
Returns a copy of the string without leading white spaces.
Name Type Description
str string The string to trim
Returns:
Type Description
String The trimmed string

staticDuString.occurences(string, item){int}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4544
Counts the number of occurences of item in string
Name Type Description
string string The string where to count
item string the string to search
Returns:
Type Description
int the number of occurences

staticDuString.parseBool(string, caseSensitive){boolean}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4559
Parses the string as a boolean.
The following strings are falsy:
'false', '0', '', 'null', 'undefined', 'NaN'.
Note that any string consisiting only in any number of 0 will be falsy.
Name Type Default Description
string string The string to parse
caseSensitive boolean true optional When false, 'FALSE', 'nan', 'UNdefined'... for example will be falsy too.
Returns:
Type Description
boolean The resulting boolean

staticDuString.replace(string, find, replace, caseSensitive){string}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4583
Replaces all occurences of a substring by another and returns the new string.
Name Type Default Description
string string The original string
find string The substring to replace
replace string The new substring to insert
caseSensitive boolean true optional Optionnal. Do a case sensitive search of substring.
Returns:
Type Description
string The new string

staticDuString.rightTrim(str){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4713
Returns a copy of the string without trailing white spaces.
Name Type Description
str string The string to trim
Returns:
Type Description
String The trimmed string

staticDuString.trim(str){String}

D:/DEV_SRC/RxOT/DuPSF/tools/output/DuPSF.jsxinc, line 4693
Returns a copy of the string without leading and trailing white spaces.
Name Type Description
str string The string to trim
Returns:
Type Description
String The trimmed string