str pad
Pad a string to a specified minimum length from another string
[...] = optional ... = your value
[var $... = ]str_pad $val=…;$pad_length=…;$pad_string=…[;$pad_type=…]
Notes
$pad_length must be specified it is the minimum total length of the string after padding
NOT the length of the padding
$pad_string is optional (defaults to spaces)
$pad_type is optional (defaults to right)
Options are
STR_PAD_RIGHT
STR_PAD_LEFT
STR_PAD_BOTH the padding is split evenly with any extra going to the right
Example code
Example output
Reloadinput = foobar
only 1 space will be visible in normal output
output = |foobar |
pre formatted output shows all the spaces
output = |foobar |
input = foobar
output = 1234foobar12345