logo
Home XtGem- Templates- XtScript- bottom
Pad a string to a specified minimum length from another string
[...] = optional ... = your value
[var $... = ]str_pad $val=…;$pad_length=…;$pad_string=…[;$pad_type=…]
$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
Show as text
Show as text
Reload
input = 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
Powered by XtGem
About us Contact Forum top