Next: SRFI-13 Miscellaneous, Previous: SRFI-13 Fold/Unfold/Map, Up: SRFI-13
These procedures are special substring procedures, which can also be
used for replicating strings. They are a bit tricky to use, but
consider this code fragment, which replicates the input string
"foo" so often that the resulting string has a length of six.
(xsubstring "foo" 0 6)
⇒ "foofoo"
This is the extended substring procedure that implements replicated copying of a substring of some string.
s is a string, start and end are optional arguments that demarcate a substring of s, defaulting to 0 and the length of s. Replicate this substring up and down index space, in both the positive and negative directions.
xsubstringreturns the substring of this string beginning at index from, and ending at to, which defaults to from + (end - start).
Exactly the same as
xsubstring, but the extracted text is written into the string target starting at index tstart. The operation is not defined if(eq?target s)or these arguments share storage – you cannot copy a string on top of itself.