segment.icn: Procedures to segment string

link segment
June 10, 1988; William H. Mitchell
This file is in the public domain.

   These procedures segment a string s into consecutive substrings
consisting of characters that respectively do/do not occur in c.
segment(s,c) generates the substrings, while seglist produces a list
of the segments.  For example,

        segment("Not a sentence.",&letters)

generates

        "Not"
        " "
        "a"
        " "
        "sentence"
        "."
while
        seglist("Not a sentence.",&letters)

produces

        ["Not"," ","a","sentence","."]

Source code | Program Library Page | Icon Home Page