Length ViewHelper <f:length>
The LengthViewHelper returns the length of a given string. Setting the character encoding is optional.
Examples
Simple example
<f:length value="Hello, World!" />
Copied!
Output:
13
Copied!
Example with encoding
<f:length value="Hello, World!" encoding="UTF-8" />
Copied!
Output:
13
Copied!
For supported character encodings see https://www.php.net/manual/en/mbstring.supported-encodings.php
Inline notation
{f:length(value: 'Hello, World!')}
Copied!
Output:
13
Copied!
Go to the source code of this ViewHelper: LengthViewHelper.php (GitHub).
Arguments
The following arguments are available for the length ViewHelper:
encoding
-
- Type
- string
Character encoding
value
-
- Type
- mixed
An string