StringUtils

Methods

(inner) capitalize(s)

turn first character of a string to uppercase

Source:
Parameters:
Name Type Description
s String

(inner) capitalizeWords(s) → {String}

turn each word first letter to uppercase

Source:
Parameters:
Name Type Description
s String

string to transform

Returns:
Type:
String

(inner) encodeHTML(s) → {String}

replace characters like chevrons in html string

Source:
Parameters:
Name Type Description
s String
Returns:
Type:
String

(inner) generateHexKey() → {String}

code date timestamp in hexadecimal string

Source:
Returns:
Type:
String
Example
// current time: 1590247414800
// returns "1724221dc10"
generateHexKey()

(inner) generateRandom(lopt, pool) → {String}

Generate a random string from a number of character and a pool of

Source:
Parameters:
Name Type Attributes Default Description
l Number <optional>
6

string length

pool Array.<String>

possible characters to generate the string

Returns:
Type:
String

(inner) nFormatter(num, digitsopt)

format a number in counterpart unit

Source:
Parameters:
Name Type Attributes Default Description
num Number

number to transform

digits Number <optional>
0

number of decimal digits

Example
//returns "10M"
nFormatter(10000000)

(inner) replaceAll(str, search, replacement) → {String}

replace all occurrences of a search with a replacement in a String

Source:
Parameters:
Name Type Description
str String
search String
replacement String
Returns:
Type:
String

(inner) secsToMin(d) → {String}

transform a number in seconds in a string

Source:
Parameters:
Name Type Description
d Number

Seconds integer

Returns:
Type:
String

string in format hh:mm:ss

(inner) stringToFunction(str) → {function}

Returns a function from a string property path

Source:
Parameters:
Name Type Description
str String
Returns:
Type:
function

function

Example
//returns addEventListener
 stringToFunction("window.addEventListener");

(inner) unCapitalize(s) → {String}

turn first character of a string to lowercase

Source:
Parameters:
Name Type Description
s String
Returns:
Type:
String