Format.trim ViewHelper <f:format.trim>
Note
This reference is part of the documentation of Fluid Standalone. If you are working with Fluid in TYPO3 CMS, please refer to TYPO3's ViewHelper reference instead.
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!
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.