TOKEN

From STX Wiki
< Programmer Guide‎ | Command Reference
Revision as of 15:05, 17 May 2010 by 193.171.195.8 (talk) (initial import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

TOKEN

var := TOKEN [ /S ] [ /D=delimiter ] /- index string1 string2

-> var = 'token' or empty if index is not a number or outside the range 0 .. nTokens-1

This command, similar to the WORD command, tokenises a string using blanks, or the specified delimiter.

When using TOKEN, do not forget to use the "/-" option before the first argument (and after any other options). Without the "/-" option, any argument starting with a slash will be mistaken for an option.

index
The zero-based index of the word to return (0 <= index <= nWords-1).
string1, string2
A string to tokenise.
/S
If set, the function sets the return code on failure. Otherwise, it sets the return code to 0, even if the parameters are invalid.
/D
Set the delimiter using the following format:
/D=delimiter
E.g.:
  1. var := token /D=, /- $#index $#wordlist
The default delimiter is a blank.

Example:

#str := set 'to be, or not to be, that is the question'
#var := token /D=, /- 1 $#str
um The second comma separated value in the string "$#str" is "$#var"
// will return ' or not to be'

Navigation menu

Personal tools