ez.no / exponential / documentation / reference / template operators / strings / pad
$input_string|pad( length [,padding] )
| Name | Type | Description | Required |
|---|---|---|---|
| length | integer | Desired length of string. | yes |
| padding | character | Desired padding character. | no |
padded version of input string.
Makes sure that the input string is at least length characters long by inserting extra characters at the end (padding). It is possible to specify what character to use with the optional padding parameter. Default pad character is the space character (' ', ascii 32).
Example 1
{"Too short!"|pad( 16 )}
returns the string "Too short! ".
Example 2
{"Too short!"|pad( 16, "-" )}
returns the string "Too short!------".
Comments