chickadee » srfi-152 » string-break

(string-span string pred [start end]) → [string string]procedure
(string-break string pred [start end]) → [string string]procedure

string-span splits the substring of string specified by start and end into the longest initial prefix whose elements all satisfy pred, and the remaining tail. string-break inverts the sense of the predicate: the tail commences with the first element of the input string that satisfies the predicate. (Not SRFI 13 procedures.)

In other words: string-span finds the initial span of elements satisfying pred, and string-break breaks the string at the first element satisfying pred.

string-span is equivalent to

(values (string-take-while pred string)
        (string-drop-while pred string))