Format.padding ViewHelper <f:format.padding>
¶
Formats a string using PHPs str_pad
function.
See https://www.php.net/manual/en/function.str-pad.
Examples¶
Defaults¶
<f:format.padding padLength="10">TYPO3</f:format.padding>
Copied!
Output:
TYPO3
Copied!
TYPO3
Specify padding string¶
<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
Copied!
TYPO3-=-=-
Specify padding type¶
<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
Copied!
--TYPO3---
Source code¶
Go to the source code of this ViewHelper: PaddingViewHelper.php (GitHub).
Arguments¶
The following arguments are available for <f:format.padding>
:
-
value
¶ -
- Type
- string
String to format
-
padLength
¶ -
- Type
- mixed
- Required
true
Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, no padding takes place.
-
padString
¶ -
- Type
- string
- Default
' '
The padding string
-
padType
¶ -
- Type
- string
- Default
'right'
Append the padding at this site (Possible values: right,left,both. Default: right)