Search                        Top                                  Index
HELP STRINGIN                                        Steven Hardy, March 1982

    stringin(string) -> character-repeater;

This procedure, which takes a string as argument, returns a character
repeater for the string, that is, a procedure which each time it is called
produces the next character from the string, and TERMIN when the string is
exhausted.

INCHARITEM can be applied to the character repeater to produce an item
repeater (which will do lexical analysis of the stream of characters from the
string.)

For example to define a procedure to convert a string of characters to a list
of POP11 text items:

    define string_to_list(string) -> list;
        vars items, item;
        incharitem(stringin(string)) -> items;
        [%until (items() ->> item) == termin do item enduntil%] -> list;
    enddefine;

    string_to_list('99 trombones and 3.25 cheeses') =>
    ** [99 trombones and 3.25 cheeses]

See HELP * STRINGS, *ASCII, *INCHARITEM.