Functions
Browse all available utility functions by category
camelCase
Converts string to camel case.
Example:
camelCase('Foo Bar'); // 'fooBar'capitalize
Converts the first character of string to upper case and the remaining to lower case.
Example:
capitalize('FRED'); // 'Fred'deburr
Deburrs string by converting Latin-1 Supplement and Latin Extended-A letters to basic Latin letters and removing combining diacritical marks.
Example:
deburr('déjà vu'); // 'deja vu'endsWith
Checks if string ends with the given target string.
Example:
endsWith('abc', 'c'); // trueescape
Converts the characters "&", "<", ">", '"', and "'" in string to their corresponding HTML entities.
Example:
escape('fred, barney, & pebbles'); // 'fred, barney, & pebbles'escapeRegExp
Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string.
Example:
escapeRegExp('[lodash](https://lodash.com/)'); // '\\[lodash\\]\\(https://lodash\\.com/\\)'kebabCase
Converts string to kebab case.
Example:
kebabCase('Foo Bar'); // 'foo-bar'lowerCase
Converts string, as space separated words, to lower case.
Example:
lowerCase('--Foo-Bar--'); // 'foo bar'lowerFirst
Converts the first character of string to lower case.
Example:
lowerFirst('Fred'); // 'fred'pad
Pads string on the left and right sides if it's shorter than length. Padding characters are truncated if they can't be evenly divided by length.
Example:
pad('abc', 8); // ' abc 'padEnd
Pads string on the right side if it's shorter than length. Padding characters are truncated if they exceed length.
Example:
padEnd('abc', 6); // 'abc 'padStart
Pads string on the left side if it's shorter than length. Padding characters are truncated if they exceed length.
Example:
padStart('abc', 6); // ' abc'parseInt
Converts string to an integer of the specified radix.
Example:
parseInt('08'); // 8repeat
Repeats the given string n times.
Example:
repeat('*', 3); // '***'replace
Replaces matches for pattern in string with replacement.
Example:
replace('Hi Fred', 'Fred', 'Barney'); // 'Hi Barney'snakeCase
Converts string to snake case.
Example:
snakeCase('Foo Bar'); // 'foo_bar'split
Splits string by separator.
Example:
split('a-b-c', '-', 2); // ['a', 'b']startCase
Converts string to start case.
Example:
startCase('--foo-bar--'); // 'Foo Bar'startsWith
Checks if string starts with the given target string.
Example:
startsWith('abc', 'a'); // truetoLower
Converts string, as a whole, to lower case.
Example:
toLower('--Foo-Bar--'); // '--foo-bar--'toUpper
Converts string, as a whole, to upper case.
Example:
toUpper('--foo-bar--'); // '--FOO-BAR--'trim
Removes leading and trailing whitespace or specified characters from string.
Example:
trim(' abc '); // 'abc'trimEnd
Removes trailing whitespace or specified characters from string.
Example:
trimEnd(' abc '); // ' abc'trimStart
Removes leading whitespace or specified characters from string.
Example:
trimStart(' abc '); // 'abc 'truncate
Truncates string if it's longer than the given maximum string length. The last characters of the truncated string are replaced with the omission string which defaults to "...".
Example:
truncate('hi-diddly-ho there, neighborino'); // 'hi-diddly-ho there, neighbo...'unescape
The inverse of escape; this method converts the HTML entities &, <, >, ", and ' in string to their corresponding characters.
Example:
unescape('fred, barney, & pebbles'); // 'fred, barney, & pebbles'upperCase
Converts string, as space separated words, to upper case.
Example:
upperCase('--foo-bar--'); // 'FOO BAR'upperFirst
Converts the first character of string to upper case.
Example:
upperFirst('fred'); // 'Fred'words
Splits string into an array of its words.
Example:
words('fred, barney, & pebbles'); // ['fred', 'barney', 'pebbles']