Format.trim ViewHelper <f:format.trim>
This ViewHelper strips whitespace (or other characters) from the beginning and end of a string.
Possible sides are:
both
(default)- Strip whitespace (or other characters) from the beginning and end of a string
left
orstart
- Strip whitespace (or other characters) from the beginning of a string
right
orend
- Strip whitespace (or other characters) from the end of a string
Examples
Defaults
#<f:format.trim> String to be trimmed. </f:format.trim>#
Copied!
#String to be trimmed.#
Copied!
Trim only one side
#<f:format.trim side="right"> String to be trimmed. </f:format.trim>#
Copied!
# String to be trimmed.#
Copied!
Trim special characters
#<f:format.trim characters=" St."> String to be trimmed. </f:format.trim>#
Copied!
#ring to be trimmed#
Copied!
Source code
Go to the source code of this ViewHelper: Format\TrimViewHelper.php (GitHub).
Arguments
The following arguments are available for the format.trim ViewHelper:
characters
-
- Type
- string
Optionally, the stripped characters can also be specified using the characters parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.
side
-
- Type
- string
- Default
- 'both'
The side to apply, must be one of this' CASE_* constants. Defaults to both application.
value
-
- Type
- string
The string value to be trimmed. If not given, the evaluated child nodes will be used.