Converts first letter of the string to uppercase. ('foo Bar') => 'Foo Bar'
Left/right-pad a string. Alias for pad(str, length, padStr, 'both') ('1', 8, '0') => '00001000'
Convert string to an array of characters. ('Hello') => ['H','e','l','l','o']
Chop a string into pieces. ('whitespace', 3) => ['whi','tes','pac','e']
String to chop
Size of the pieces
Converts string to camelized class name. ('some_class_name') => 'SomeClassName'
Compress some whitespaces to one. (' foo bar ') => 'foo bar'
Tests if string contains a substring. ('foobar', 'ob') => true
Count occurences of a sub string. ('Hello world', 'l') => 3
Converts a underscored or camelized string into an dasherized one. ('MozTransform') => '-moz-transform'
Checks if string ends with another string. ('image.gif', 'gif') => true
Converts HTML special characters to their entity equivalents. ('
Escape a string for use in a regular expression.
Converts an underscored, camelized, or dasherized string into a humanized one. Also removes beginning and ending whitespace, and removes the postfix '_id'. (' capitalize dash-CamelCase_underscore trim ') => 'Capitalize dash camel case underscore trim'
Tests if string contains a substring. ('foobar', 'ob') => true
Insert a string at index.
Determine if a string is 'blank.'
Joins strings together with given separator. (' ', 'foo', 'bar') => 'foo bar'
Calculates Levenshtein distance between two strings. ('kitten', 'kittah') => 2
Split string by newlines character. ('Hello\nWorld') => ['Hello', 'World']
Right-pad a string. Alias for pad(str, length, padStr, 'right') ('1', 8, '0') => '10000000'
Left-pad a string. Alias for pad(str, length, padStr, 'left') ('1', 8, '0') => '00000001'
Left/right-pad a string. Alias for pad(str, length, padStr, 'both') ('1', 8, '0') => '00001000'
Left trim. Similar to trim, but only for left side.
Left trim. Similar to trim, but only for left side.
Naturally sort strings like humans would do. Caution: this function is charset dependent.
Formats the numbers. (1000, 2) => '1,000.00' (123456789.123, 5, '.', ',') => '123,456,789.12300'
Pads a string with characters until the total string length is equal to the passed length parameter. By default, pads on the left with the space char (' '). padStr is truncated to a single character if necessary. ('1', 8) => ' 1' ('1', 8, '0') => '00000001' ('1', 8, '0', 'right') => '10000000' ('1', 8, '0', 'both') => '00001000' ('1', 8, 'bleepblorp', 'both') => 'bbbb1bbb'
Elegant version of truncate. Makes sure the pruned string does not exceed the original length. Avoid half-chopped words when truncating. ('Hello, cruel world', 15) => 'Hello, cruel...'
Quotes a string. quoteChar defaults to " ('foo') => '"foo"'
Quotes a string. quoteChar defaults to " ('foo') => '"foo"'
Repeat a string with an optional separator. ('foo', 3) => 'foofoofoo' ('foo', 3, 'bar') => 'foobarfoobarfoo'
Return reversed string. ('foobar') => 'raboof'
Left-pad a string. Alias for pad(str, length, padStr, 'left') ('1', 8, '0') => '00000001'
Right-pad a string. Alias for pad(str, length, padStr, 'right') ('1', 8, '0') => '10000000'
Right trim. Similar to trim, but only for right side.
Right trim. Similar to trim, but only for right side.
Transform text into a URL slug. Replaces whitespaces, accentuated, and special characters with a dash. ('Un éléphant à l'orée du bois') => 'un-elephant-a-loree-du-bois'
Splice a string like an array.
C like string formatting. _.sprintf('%.1f', 1.17) => '1.2'
Checks if string starts with another string. ('image.gif', 'image') => true
Searches a string from left to right for a pattern. Returns a substring consisting of the characters in the string that are to the left of the pattern. If no match found, returns entire string. ('This_is_a_teststring').strLeft('') => 'This'
Searches a string from right to left for a pattern. Returns a substring consisting of the characters in the string that are to the left of the pattern. If no match found, returns entire string. ('This_is_a_teststring').strLeftBack('') => 'This_is_a_test'
Searches a string from left to right for a pattern. Returns a substring consisting of the characters in the string that are to the right of the pattern. If no match found, returns entire string. ('This_is_a_teststring').strRight('') => 'is_a_test_string'
Searches a string from right to left for a pattern. Returns a substring consisting of the characters in the string that are to the right of the pattern. If no match found, returns entire string. ('This_is_a_teststring').strRightBack('') => 'string'
Trims defined characters from begining and ending of the string. Defaults to whitespace characters. (' foobar ') => 'foobar' ('-foobar-', '_-') => 'foobar'
Removes all html tags from string.
Returns the successor to passed string. ('a') => 'b'
Surround a string with another string. ('foo', 'ab') => 'abfooab'
Returns a copy of the string in which all the case-based characters have had their case swapped. ('hELLO') => 'Hello'
Capitalize first letter of every word in the string. ('my name is epeli') => 'My Name Is Epeli'
Turn strings that can be commonly considered as booleans to real booleans. Such as "true", "false", "1" and "0". This function is case insensitive. ('true') => true ('FALSE') => false ('random') => undefined ('truthy', ['truthy'], ['falsy']) => true ('true only at start', [/^true/]) => true
Parse string to number. Returns NaN if string can't be parsed to number. ('2.556').toNumber() => 3 ('2.556').toNumber(1) => 2.6
Join an array into a human readable sentence. (['jQuery', 'Mootools', 'Prototype']) => 'jQuery, Mootools and Prototype' (['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ') => 'jQuery, Mootools unt Prototype'
The same as toSentence, but uses ', ' as default for lastSeparator.
Trims defined characters from begining and ending of the string. Defaults to whitespace characters. (' foobar ') => 'foobar' ('-foobar-', '_-') => 'foobar'
Truncate string to specified length. ('Hello world').truncate(5) => 'Hello...' ('Hello').truncate(10) => 'Hello'
Converts a camelized or dasherized string into an underscored one. ('MozTransform') => 'moz_transform'
Converts entity characters to HTML equivalents. ('<div>Blah blah blah</div>') => '
Unquotes a string. quoteChar defaults to " ('"foo"') => 'foo' ("'foo'", "'") => 'foo'
Split string by delimiter (String or RegExp). /\s+/ by default. (' I love you ') => ['I','love','you'] ('I_loveyou', '') => ['I','love','you']
Split string by delimiter (String or RegExp). /\s+/ by default. (' I love you ') => ['I','love','you'] ('I_loveyou', '') => ['I','love','you']
Split string by delimiter (String or RegExp). /\s+/ by default. (' I love you ') => ['I','love','you'] ('I_loveyou', '') => ['I','love','you']
Converts underscored or dasherized string to a camelized one. ('-moz-transform') => 'MozTransform'