(lpad string integer)


Pad that string with spaces on the left.


This function controls the length and spacing of the 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 beginning (or left side) of the string.

NOTE Use rpad to perform the same operations on the end (or right side) of the string.

Examples

Code Returns
(lpad "Planet X" 4) "Plan"
(lpad "Planet X" 15) "Planet X"
(setq a "Planet X")  
(lpad a 6) "Planet"

Tell me about...

(rpad string integer)

(setq symbol1 statement1 [symbol2 statement2] ...)

LISP Compatibility

Programming Overview of LISP (LISt Processing) Language