ez.no / exponential / documentation / reference / template operators / strings / wrap
$string|wrap([width [, break_sequence [, cut]]])
| Name | Type | Description | Required |
|---|---|---|---|
| width | integer | Desired width. | no |
| break_sequence | string | Custom break sequence. | no |
| cut | boolean | Force wrap. | no |
wrapped version of input string.
By inserting newline ('\n') characters into the inputted string, this operator wraps a given text at a specified position. If the width parameter is omitted, it will automatically wrap at 80. The break_sequence parameter specifies a string containing the desired break sequence to use, default is '\n' (newline). The cut parameter specifies if the string should always be wrapped at the specified width or not. In other words: if you have a word that is larger than the given width, it will be broken apart.
{"Hello world"|wrap(5)}
returns the string
"Hello
world"
Comments