chickadee » srfi-135 » textual-take-right

textual-take textual ncharsprocedure
textual-drop textual ncharsprocedure
textual-take-right textual ncharsprocedure
textual-drop-right textual ncharsprocedure

textual-take returns a text containing the first nchars of textual; textual-drop returns a text containing all but the first nchars of textual. textual-take-right returns a text containing the last nchars of textual; textual-drop-right returns a text containing all but the last nchars of textual.

If textual is a string, then that string does not share any storage with the result, so subsequent mutation of that string will not affect the text returned by these procedures. If textual is a text, the result shares storage with that text.

(textual-take "Pete Szilagyi" 6) ⇒ «Pete S»
(textual-drop "Pete Szilagyi" 6) ⇒ «zilagyi»

(textual-take-right "Beta rules" 5) ⇒ «rules»
(textual-drop-right "Beta rules" 5) ⇒ «Beta »

;; It is an error to take or drop more characters than are
;; in the text:
(textual-take "foo" 37) ⇒ error