str2toks.icn: Procedures to convert string to tokens

link str2toks
March 3, 1996; Richard L. Goerwitz
This file is in the public domain.

str2toks:  cset x string x integer x integer -> strings
           (c, s, i, j)                      -> s1, s2, ...

    Suspends portions of s[i:j] delimited by characters in c.  The
    usual defaults for s, i, and j apply, although str2toks is not
    meant as a primitive scanning function (note that it suspends
    strings, and not integer positions).

    Defaults:

        c     ~(&letters ++ &digits)
        s     &subject
        i     &pos if s is defaulted, otherwise 1
        j     0

Basically, this file is just a very simple piece of code wrapped up
with some sensible defaults, and isolated in its own procedure.
____________________________________________________________

Example:

    "hello, how are ya?" ? every write(str2toks())

The above expression would write to &output, on successive lines,
the words "hello", "how", "are", and finally "ya" (skipping the
punctuation).  Naturally, the beginning and end of the line count
as delimiters.

Note that if i > 1 or j < *s+1 some tokens may end up appearing
truncated.  Normally, one should simply use the defaults for i and
j - and for s as well when inside a scanning expression.

Source code | Program Library Page | Icon Home Page