unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* doc string-pad string-pad-right
@ 2005-02-09  0:39 Kevin Ryde
  0 siblings, 0 replies; only message in thread
From: Kevin Ryde @ 2005-02-09  0:39 UTC (permalink / raw)


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).


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-09  0:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-09  0:39 doc string-pad string-pad-right Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).