chickadee » srfi-130 » string-drop

string-takeprocedure
string-dropprocedure
string-take-rightprocedure
string-drop-rightprocedure

string-take returns the first nchars of s; string-drop returns all but the first nchars of s. string-take-right returns the last nchars of s; string-drop-right returns all but the last nchars of s.

If these procedures produce the entire string, they may return either s or a copy of s; in some implementations, proper substrings may share memory with s.

Examples:

(string-take "Pete Szilagyi" 6) => "Pete S"
(string-drop "Pete Szilagyi" 6) => "zilagyi"

(string-take-right "Beta rules" 5) => "rules"
(string-drop-right "Beta rules" 5) => "Beta "

It is an error to take or drop more characters than are in the string:

(string-take "foo" 37) => error