(rpad string integer)
Pad that string with spaces on the right.
This function controls the length and spacing of a string when it is printed. The integer argument represents the number of characters or spaces the string should have. When the number is less than the total number of characters in the string, the string is truncated to allow only the specified number of characters. When the number is greater than the number of characters in the string, additional spaces are added to the end (or right side) of the string.
NOTE Use lpad to handle the same operations on the beginning (or left side) of the string.
Examples
Code | Returns |
---|---|
(rpad "Einstein" 4) | "Eins" |
(rpad "Einstein" 15) | "Einstein " |
(setq a "Einstein") | |
(rpad a 6) | "Einste" |