chickadee » srfi-135 » textual-trim

(textual-trim textual [pred start end]) → textprocedure
(textual-trim-right textual [pred start end]) → textprocedure
(textual-trim-both textual [pred start end]) → textprocedure

Returns a text obtained from the given subrange of textual by skipping over all characters on the left / on the right / on both sides that satisfy the second argument pred: pred defaults to char-whitespace?.

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 whenever sharing would be space-efficient.

(textual-trim-both "  The outlook wasn't brilliant,  \n\r") ⇒ «The outlook wasn't brilliant,»