[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
doc string-pad string-pad-right
From: |
Kevin Ryde |
Subject: |
doc string-pad string-pad-right |
Date: |
Wed, 09 Feb 2005 11:39:22 +1100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Where the doc for string-pad says it's "right-padded" it makes me
think it does its padding on the right end, but in fact it's on the
left. Maybe it was trying to say something like "right-justified" in
the field. In any case I gave it and string-pad-right a bit of
polish.
The possible sharing described is per srfi-13. This had been saying
the return was a "new string", but I'd like to quietly drop that in
favour of what the srfi says.
-- Scheme Procedure: string-pad s len [chr [start [end]]]
-- Scheme Procedure: string-pad-right s len [chr [start [end]]]
-- C Function: scm_string_pad (s, len, chr, start, end)
-- C Function: scm_string_pad_right (s, len, chr, start, end)
Take characters START to END from the string S and either pad with
CHAR or truncate them to give LEN characters.
`string-pad' pads or truncates on the left, so for example
(string-pad "x" 3) => " x"
(string-pad "abcde" 3) => "cde"
`string-pad-right' pads or truncates on the right, so for example
(string-pad-right "x" 3) => "x "
(string-pad-right "abcde" 3) => "abc"
The return string may share storage with S, or it can be S itself
(if START to END is the whole string and it's already LEN
characters).
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- doc string-pad string-pad-right,
Kevin Ryde <=