String helpers
camelcase
camelCase the characters in the given string
.
Parameters:
string
{String}: The string to camelcase.
Returns {String}
Example:
capitalize
Capitalize the first word in a sentence.
Parameters:
str
{String}
Returns {String}
Example:
capitalizeAll
Capitalize all words in a string.
Parameters:
str
{String}
Returns {String}
Example:
center
Center a string
using non-breaking spaces
Parameters:
str
{String}spaces
{String}
Returns {String}
chop
Like trim, but removes both extraneous whitespace and non-word characters from the beginning and end of a string
.
Parameters:
string
{String}
Returns {String}
Example:
dashcase
Parameters:
string
{String}
Returns {String}
Example:
dotcase
dot.case the characters in string.
Parameters:
string
{String}
Returns {String}
Example:
hyphenate
Replace spaces in a string with hyphens.
Parameters:
str
{String}
Returns {String}
Example:
isString
Return true if value
is a string.
Parameters:
value
{String}
Returns {Boolean}
Example:
lowercase
Lowercase all characters in the given string.
Parameters:
str
{String}
Returns {String}
Example:
occurrences
Return the number of occurrences of substring
within the given string
.
Parameters:
str
{String}substring
{String}returns
{Number}: Number of occurrences
Example:
pascalcase
PascalCase the characters in string
.
Parameters:
string
{String}
Returns {String}
Example:
pathcase
path/case the characters in string
Parameters:
string
{String}returns
{String}
Example:
plusify
Replace spaces in the given string
with pluses.
Parameters:
str
{String}: The input string
Returns {String}: Input string with spaces replaced by plus signs
Example:
replace
Replace all occurrences of substring a
with substring b
.
Parameters:
str
{String}a
{String}b
{String}
Returns {String}
Example:
reverse
Reverse a string.
Parameters:
str
{String}
Returns {String}
Example:
sentence
Sentence case the given string
Parameters:
str
{String}
Returns {String}
Example:
snakecase
Snake_case the characters in the given string
.
Parameters:
string
{String}
Returns {String}
Example:
split
Split string
by the given character
.
Parameters:
string
{String}: The string to be split
Returns {String} character
: Default is an empty string.
Example:
startsWith
Tests whether a string begins with the given prefix.
Parameters:
prefix
{String}testString
{String}options
{String}
Returns {String}
Example:
titleize
str
{String}returns
{String}
Example:
trim
Removes extraneous whitespace from the beginning and end of a string
.
Parameters:
string
{String}: The string to trim.
Returns {String}
Example:
uppercase
Uppercase all of the characters in the given string. If used as a block helper it will uppercase the entire block. This helper does not support inverse blocks.
Parameters:
str
{String}: The string to uppercaseoptions
{Object}: Handlebars options object
Returns {String}
Example: