Working with strings
regexExtract
helper supports extraction of values matching a regular expresson from a string.
A single value can be extracted like this:
trim
helper to remove whitespace from the start and end of the input:
abbreviate
truncates a string if it is longer than the specified number of characters.
Truncated strings will end with a translatable ellipsis sequence (”…”).
For instance the following template:
capitalize
will make the first letter of each word in the passed string a capital e.g.
capitalizeFirst
will capitalise the first character of the value passed e.g.
center
centers the value in a field of a given width e.g.
cut
removes all instances of the parameter from the given string.
defaultIfEmpty
outputs the passed value if it is not empty, or the default otherwise e.g.
join
takes a set of parameters or a collection and builds a single string, with
each item separated by the specified parameter.
ljust
left-aligns the value in a field of a given width, optionally taking a padding character.
rjust
right-aligns the value in the same manner
lower
and upper
convert the value to all lowercase and all uppercase:
replace
replaces all occurrences of the specified substring with the replacement value.
slugify
converts to lowercase, removes non-word characters (alphanumerics and
underscores) and converts spaces to hyphens. Also strips leading and trailing whitespace.
stripTags
strips all [X]HTML tags.
substring
outputs the portion of a string value between two indices. If only
one index is specified the substring between this point and the end will be returned.
wordWrap
wraps words at specified line length.
yesno
maps values for true, false and optionally null, to the strings “yes”,
“no”, “maybe”.