Utils.Strings Class
Provides string mutating functions
Methods
camelCase
(
String
-
x
Converts string which are separated by dashes or underscores into a camelcase'd variation
Parameters:
-
xStringThe string to transform
Returns:
String:
Converted string
Example:
import {camelCase} from './utils/string';
var str = 'this-is-the-string';
camelCase(str);
// -> 'thisIsTheString'
dashCase
(
String
-
x
Transforms strings in camelCase or separated_by_underscores in strings which are separated-by-dashes
Parameters:
-
xStringThe string to transform
Returns:
String:
Converted string
Example:
import {dashCase} from './utils/string';
var str = 'thisIsTheString';
dashCase(str);
// -> 'this-is-the-string'
trim
(
String
-
x
Removes whitespace from the beginning and the end of a given string
Parameters:
-
xStringThe string to trim
Returns:
String:
Trimmed string
Example:
import {trim} from './utils/string';
var str = ' a string ';
trim(str);
// -> 'a string'
trimLeft
(
String
-
x
Removes whitespace from the beginning of a given string
Parameters:
-
xStringThe string to trim
Returns:
String:
Trimmed string
Example:
import {trimLeft} from './utils/string';
var str = ' a string ';
trimLeft(str);
// -> 'a string '
trimRight
(
String
-
x
Removes whitespace from the end of a given string
Parameters:
-
xStringThe string to trim
Returns:
String:
Trimmed string
Example:
import {trimRight} from './utils/string';
var str = ' a string ';
trimRight(str);
// -> ' a string';
underscoreCase
(
String
-
x
Transforms strings in camelCase or separated-by-dashes in strings which are separated_by_underscores
Parameters:
-
xStringThe string to transform
Returns:
String:
Converted string
Example:
import {underscoreCase} from './utils/string';
var str = 'thisIsTheString';
underscoreCase(str);
// -> 'this_is_the_string'
