Summary
###########################################################################
File: str2toks.icn
Subject: Procedures to convert string to tokens
Author: Richard L. Goerwitz
Date: March 3, 1996
###########################################################################
This file is in the public domain.
###########################################################################
Version: 1.2
###########################################################################
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.
###########################################################################
Procedures:
str2toks
This file is part of the (main) package.
Source code.
str2toks(c, s, i, j)
This page produced by UniDoc on 2021/04/15 @ 23:59:54.