chickadee » srfi-13 » string-take-right

string-take s ncharsprocedure
string-drop s ncharsprocedure
string-take-right s ncharsprocedure
string-drop-right s ncharsprocedure

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.

(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''