String Operators
When we need to work with strings, these operators will help with your markdown.
List of Operators
{{ append }}{{ camelcase }}{{ capitalize }}{{ capitalizeAll }}{{ center }}{{ chop }}{{ dashcase }}{{ dotcase }}{{ downcase }}{{ ellipsis }}{{ hyphenate }}{{ isString }}{{ lowercase }}{{ occurrences }}{{ pascalcase }}{{ pathcase }}{{ plusify }}{{ prepend }}{{ raw }}{{ remove }}{{ removeFirst }}{{ replace }}{{ replaceFirst }}{{ reverse }}{{ sentence }}{{ snakecase }}{{ split }}{{ startsWith }}{{ titleize }}{{ trim }}{{ trimLeft }}{{ trimRight }}{{ truncate }}{{ truncateWords }}{{ upcase }}{{ uppercase }}
{{ append }}
Append the specified suffix to the given string.
Params
strsuffixreturns
Example
{{ camelcase }}
camelCase the characters in the given string.
Params
string: The string to camelcase.returns
Example
{{ capitalize }}
Capitalize the first word in a sentence.
Params
strreturns
Example
{{ capitalizeAll }}
Capitalize all words in a string.
Params
strreturns
Example
{{ center }}
Center a string using non-breaking spaces
Params
strspacesreturns
{{ chop }}
Like trim, but removes both extraneous whitespace and non-word characters from the beginning and end of a string.
Params
string: The string to chop.returns
Example
{{ dashcase }}
dash-case the characters in string. Replaces non-word characters and periods with hyphens.
Params
stringreturns
Example
{{ dotcase }}
dot.case the characters in string.
Params
stringreturns
Example
{{ downcase }}
Lowercase all of the characters in the given string. Alias for lowercase.
Params
stringreturns
Example
{{ ellipsis }}
Truncates a string to the specified length, and appends it with an elipsis, ….
Params
strlength: The desired length of the returned string.returns: The truncated string.
Example
{{ hyphenate }}
Replace spaces in a string with hyphens.
Params
strreturns
Example
{{ isString }}
Return true if value is a string.
Params
valuereturns
Example
{{ lowercase }}
Lowercase all characters in the given string.
Params
strreturns
Example
{{ occurrences }}
Return the number of occurrences of substring within the given string.
Params
strsubstringreturns: Number of occurrences
Example
{{ pascalcase }}
PascalCase the characters in string.
Params
stringreturns
Example
{{ pathcase }}
path/case the characters in string.
Params
stringreturns
Example
{{ plusify }}
Replace spaces in the given string with pluses.
Params
str: The input stringreturns: Input string with spaces replaced by plus signs
Example
{{ prepend }}
Prepends the given string with the specified prefix.
Params
strprefixreturns
Example
{{ raw }}
Render a block without processing mustache templates inside the block.
Params
optionsreturns
Example
{{ remove }}
Remove all occurrences of substring from the given str.
Params
strsubstringreturns
Example
{{ removeFirst }}
Remove the first occurrence of substring from the given str.
Params
strsubstringreturns
Example
{{ replace }}
Replace all occurrences of substring a with substring b.
Params
strabreturns
Example
{{ replaceFirst }}
Replace the first occurrence of substring a with substring b.
Params
strabreturns
Example
{{ reverse }}
Reverse a string.
Params
strreturns
Example
{{ sentence }}
Sentence case the given string
Params
strreturns
Example
{{ snakecase }}
snake_case the characters in the given string.
Params
stringreturns
Example
{{ split }}
Split string by the given character.
Params
string: The string to split.returnscharacter: Default is an empty string.
Example
{{ startsWith }}
Tests whether a string begins with the given prefix.
Params
prefixtestStringoptionsreturns
Example
{{ titleize }}
Title case the given string.
Params
strreturns
Example
{{ trim }}
Removes extraneous whitespace from the beginning and end of a string.
Params
string: The string to trim.returns
Example
{{ trimLeft }}
Removes extraneous whitespace from the beginning of a string.
Params
string: The string to trim.returns
Example
{{ trimRight }}
Removes extraneous whitespace from the end of a string.
Params
string: The string to trim.returns
Example
{{ truncate }}
Truncate a string to the specified length. Also see ellipsis.
Params
strlimit: The desired length of the returned string.suffix: Optionally supply a string to use as a suffix to denote when the string has been truncated. Otherwise an ellipsis (…) will be used.returns: The truncated string.
Example
{{ truncateWords }}
Truncate a string to have the specified number of words. Also see truncate.
Params
strlimit: The desired length of the returned string.suffix: Optionally supply a string to use as a suffix to denote when the string has been truncated.returns: The truncated string.
Example
{{ upcase }}
Uppercase all of the characters in the given string. Alias for uppercase.
Params
stringreturns
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.
Params
str: The string to uppercaseoptions: Handlebars options objectreturns
Example