chickadee » srfi-13 » string-tokenize

(string-tokenize s [token-set start end]) -> listprocedure

Split the string S into a list of substrings, where each substring is a maximal non-empty contiguous sequence of characters from the character set TOKEN-SET.

  • TOKEN-SET defaults to char-set:graphic (see SRFI 14 for more on character sets and char-set:graphic).
  • If START or END indices are provided, they restrict string-tokenize to operating on the indicated substring of S.

This function provides a minimal parsing facility for simple applications. More sophisticated parsers that handle quoting and backslash effects can easily be constructed using regular-expression systems; be careful not to use string-tokenize in contexts where more serious parsing is needed.

(string-tokenize "Help make programs run, run, RUN!") =>
  ("Help" "make" "programs" "run," "run," "RUN!")