chickadee » srfi-13 » string-pad-right

(string-pad s len [char start end]) -> stringprocedure
(string-pad-right s len [char start end]) -> stringprocedure

Build a string of length LEN comprised of S padded on the left (right) by as many occurrences of the character CHAR as needed. If S has more than LEN chars, it is truncated on the left (right) to length LEN. CHAR defaults to #\space.

If LEN <= END-START, the returned value is allowed to share storage with S, or be exactly S (if LEN = END-START).

(string-pad     "325" 5) => "  325"
(string-pad   "71325" 5) => "71325"
(string-pad "8871325" 5) => "71325"