API Docs for:
Show:

Utils.Strings Class

Provides string mutating functions

Methods

camelCase

(
  • x
)
String

Converts string which are separated by dashes or underscores into a camelcase'd variation

Parameters:

  • x String

    The string to transform

Returns:

String:

Converted string

Example:

import {camelCase} from './utils/string';

var str = 'this-is-the-string';

camelCase(str);
// -> 'thisIsTheString'

dashCase

(
  • x
)
String

Transforms strings in camelCase or separated_by_underscores in strings which are separated-by-dashes

Parameters:

  • x String

    The string to transform

Returns:

String:

Converted string

Example:

import {dashCase} from './utils/string';

var str = 'thisIsTheString';

dashCase(str);
// -> 'this-is-the-string'

trim

(
  • x
)
String

Removes whitespace from the beginning and the end of a given string

Parameters:

  • x String

    The string to trim

Returns:

String:

Trimmed string

Example:

import {trim} from './utils/string';

var str = '   a string   ';

trim(str);
// -> 'a string'

trimLeft

(
  • x
)
String

Removes whitespace from the beginning of a given string

Parameters:

  • x String

    The string to trim

Returns:

String:

Trimmed string

Example:

import {trimLeft} from './utils/string';

var str = '   a string   ';

trimLeft(str);
// -> 'a string   '

trimRight

(
  • x
)
String

Removes whitespace from the end of a given string

Parameters:

  • x String

    The string to trim

Returns:

String:

Trimmed string

Example:

import {trimRight} from './utils/string';

var str = '   a string   ';

trimRight(str);
// -> '   a string';

underscoreCase

(
  • x
)
String

Transforms strings in camelCase or separated-by-dashes in strings which are separated_by_underscores

Parameters:

  • x String

    The string to transform

Returns:

String:

Converted string

Example:

import {underscoreCase} from './utils/string';

var str = 'thisIsTheString';

underscoreCase(str);
// -> 'this_is_the_string'