Use string filters to manipulate strings.
Add text to the end of the current string
append: String text
Capitalize words in a string
capitalize
Removes all non-alphanumeric characters other than dashes and underscores from a string and replaces them with the separator (or nothing if the separator is empty).
classname: String separator = "-"
Convert a string to lowercase
downcase
Encode a string to be output as HTML. All special HTML characters will be converted to their equivalent HTML character entities (eg: < becomes <)
escape
Deprecated! Use json_encode instead.
Encode a string to be used output as JSON. Unlike json_encode, if the string is null this will return an empty string instead.
for_json
Alias for escape
Returns the 0-based location of the find string in the current string, or -1 if it cannot be found. If start is greater than 0, the search will begin at the specified index. To ignore capitalization, set ignoreCase to true.
index: String find Int start = 0 True/False ignorecase = false
Decode a json encoded string.
json_decode
Encode a string to be used output as JSON.
json_encode
Returns the last 0-based location of the find string in the current string, or -1 if it cannot be found. If start is greater than or equal to 0, the search will begin at the specified index. To ignore capitalization, set ignoreCase to true.
index: String find Int start = -1 True/False ignorecase = false
Add "<br />" tags in front of all newlines in the current string
Appends the text to the current value. Note that this filter behaves differently if the current value is not a string.
plus: string text
plus: int text
Add text to the beginning of the current string
prepend: String text
Remove all occurrences of search from the current string
remove: String search
Remove the first occurrence of search from the current string
remove_first: String search
Replace all occurrences of search inside the current string with replacement.
replace: String search String replacement = ""
Replace all occurrences of pattern inside the current string with replacement using a regular expression - making it possible to search for more complicated expressions and replace using the resulting matching groups. .
replace_regex: String pattern String replacement = ""
Replace the first numReplacements occurrences of search inside the current string with replacement.
replace_regex: String search String replacement = "" int numReplacements = 1
Replace the first numReplacements occurrences of pattern inside the current string with replacement using a regular expression - similar to the replace_regex filter.
replace_regex_first: String pattern String replacement = "" int numReplacements = 1
Reverses the current string. Can also be used to reverse a list.
reverse
Return the size of the current string
size
Return a part of the current string. If start is negative, will return len characters from the end of the string. If len is 0, will return all remaining characters after start. If len is negative, will return up to len characters from the end of the string.
slice: int start int len = 0
Split a string into a list of substrings separated by the given pattern
split: String pattern
Removes whitespace from the beginning and end of a string
split
Removes all HTML tags from a string
split
Removes all newlines from a string
Repeats the current value count times. This filter behaves differently if the current value is a string or if count is not an integer.
times: int count
times: int count
Truncates a string down to length characters. If the original string is longer than length characters, appends truncate_string to the end of the truncated string.
truncate: int length = 50 String truncate_string = "..."
Truncates a string down to length words. If the original string is longer than length words, appends truncate_string to the end of the truncated string.
truncate_words: int length = 50 String truncate_string = "..."
Convert a string to uppercase
upcase
Decode a UrlEncoded string. If formData is true, decodes the string as if it were submitted as part of an html form (eg: decodes the + character to a space character). If formData is false, decodes the string as a normal url_encoded string (eg: leaves the + character alone).
url_decode: boolean formData = false
Encode a string to be used in a URL. If formData is true, encodes the string as if it were submitted as part of an html form (eg: encodes the space character to the + character). If formData is false, encodes the string as a normal url string (eg: encodes the space character as %20).
url_encode: boolean formData = false