ez.no / exponential / documentation / reference / template operators / strings / shorten
$input_string|shorten( [length [, sequence] ] )
| Name | Type | Description | Required |
|---|---|---|---|
| length | integer | Desired length of returned string. | no |
| sequence | string | Custom trailing/end-sequence. | no |
shortened version of input string.
This operator shortens the input string to length characters and adds a trailing sequence. Length also includes the length of the trailing sequence. If the input string is shorter than length it will not be shortened. The default length is 80 and the default trailing sequence is "...".
{"Heavy metal rocks!"|shorten(8)}
returns the string "Heavy...".
{$node.data_map.name|shorten(5)|wash}
Returns 5 first characters of name, and HTML encodes HTML specific characters.
Log in or create a user account to comment.
Comments