Format.padding ViewHelper <f:format.padding> 

ViewHelper to format a string to specific lengths, by using PHPs str_pad function.

Go to the source code of this ViewHelper: Format\PaddingViewHelper.php (GitHub).

Examples 

Defaults 

packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10">TYPO3</f:format.padding>
Copied!
Output
TYPO3␠␠␠␠␠
Copied!

Specify padding string 

packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10" padString="-=">TYPO3</f:format.padding>
Copied!
Output
TYPO3-=-=-
Copied!

Specify padding type 

packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html
<f:format.padding padLength="10" padString="-" padType="both">TYPO3</f:format.padding>
Copied!
Output
--TYPO3---
Copied!

Arguments of the <f:format.padding> ViewHelper 

padLength

padLength
Type
int
Required
1
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

padString
Type
string
Default
' '
The padding string

padType

padType
Type
string
Default
'right'
Append the padding at this site (Possible values: right,left,both. Default: right)

value

value
Type
string
string to format