Namespace: DuString

DuString

JavaScript String related methods

Methods

staticDuString.args(string, args){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4666
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.capitalize(text){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4842
Sets the first character of the text to be capital case if it's a letter.
Note that the string is left trimmed first: any leading white space is removed.
Name Type Description
text string The source text
Returns:
Type Description
string The new text

staticDuString.endsWith(str, suffix){bool}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4687
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4813
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4793
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4710
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4775
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4616
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4630
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4653
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:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4784
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.startsWith(str, suffix){bool}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4698
Checks if a string starts with a given prefix
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.toCamelCase(text){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4826
Generates a camel case text from a snake case or standard one
Name Type Description
text string The source text
Returns:
Type Description
string The camelCase version of the text

staticDuString.trim(str){String}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4766
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

staticDuString.trimNumbers(str){String}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4803
Returns a copy of the string without trailing white spaces and numbers.
Name Type Description
str string The string to trim
Returns:
Type Description
String The trimmed string

staticDuString.unCapitalize(text){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 4855
Sets the first character of the text to be lower case if it's a letter.
Note that the string is left trimmed first: any leading white space is removed.
Name Type Description
text string The source text
Returns:
Type Description
string The new text