Strings


STRING

SUB-STRINGS

INDEX

LASTINDEX

UPCASE

LOWCASE

SIZEOF

TRIM

F2ASCII

TOKEN

<value> = token { <inputstring> , } <delimiter>

This is an implementation of C's strtok(), that can parse <inputstring> into tokens.  The first call to token is with two arguments, an input string and a delimiter, and the first token is returned in <value> . For all further calls only one argument is used, the delimiter, and the next token is returned. The delimiter may be different for each call. If no more tokens are available, an empty string is returned. Unlike in C, the input string is not destroyed.

Example 1:

%line = " abc 1234; ok;twelve eleven;1.99"

%bla = token %line, " ;"
while %bla != "" do
    println %bla
    %bla = token " ;"
done

prints
abc
1234
ok
twelve
eleven
1.99