Syntax
int pad ( string sourcestring, string length, string padchar )
Description
pad returns a new string at the exact length of characters long. The beginning of the string is the sourcestring.
If the length argument is bigger than the size of the sourcestring, then the returned string is padded with the padchar argument. Otherwise, the first length characters of sourcestring are returned.
The padchar argument can also contain multiple characters, in which case the characters return padded repeatedly.
Example
result = pad("123",5," "); {
# returns "123"
}
result = pad("123",6,"<>"); {
# returns "123<><"
}
result = pad("User Name", 3, " "); {
# returns "User"
}