This namespace contains commonly used string utility methods.
Methods
-
<static> contains(str, contains, ignoreCase) → {boolean}
-
Checks if the supplied string contains the exact given substring.
Parameters:
Name Type Argument Default Description str
string The string to check. contains
string The string to check for. ignoreCase
boolean <optional>
false Whether or not to ignore casing when performing the check. Returns:
- Type
- boolean
-
<static> contains(str, contains, ignoreCase) → {boolean}
-
Checks if the supplied string contains the given substring.
Parameters:
Name Type Argument Default Description str
string The string to check. contains
string The string to check for. ignoreCase
boolean <optional>
false Whether or not to ignore casing when performing the check. Returns:
- Type
- boolean
-
<static> containsWord(str, word, ignoreCase) → {boolean}
-
Checks if the supplied string contains the given word.
Parameters:
Name Type Argument Default Description str
string The string to check. word
string The word to check for. ignoreCase
boolean <optional>
false Whether or not to ignore casing when performing the check. Returns:
- Type
- boolean
-
<static> escapeRegExp(str) → {string}
-
Escapes a string for use in a regular expression.
Parameters:
Name Type Description str
string The string to escape. Returns:
- Type
- string
-
<static> from(str, from) → {string}
-
Returns the remainder of a string split on the first index of the given substring.
Parameters:
Name Type Description str
string The string to split. from
string The substring to split on. Returns:
- Type
- string
-
<static> random(prefix) → {string}
-
Generates a random string 9 characters long using the optional prefix if supplied.
Parameters:
Name Type Argument Description prefix
string <optional>
The prefix to append to the 9 random characters. Returns:
- Type
- string
-
<static> startsWith(str, prefix) → {boolean}
-
Checks if a string starts with the supplied prefix.
Parameters:
Name Type Description str
string The string to check. prefix
string The prefix to check for. Returns:
- Type
- boolean
-
<static> toCamelCase(str) → {string}
-
Takes the supplied string and converts it to camel case.
Parameters:
Name Type Description str
string The string to camel case. Returns:
- Type
- string