Alternate Entry Name: .SCAN
B: newpos = scan( arg, string, pos [, skipstr, stopstr] );
C: int scan(char *arg, const char *string, int pos, [const char *skipstr, const char *stopstr]);
SCAN is used to parse a string into substrings. Beginning at character position "pos" in "string", characters are skipped until a character is found which is not in "skipstr". Characters are then copied one at a time into string "arg" until a character is found which is in string "stopstr". '*0' is considered to be an element of "stopstr" but not of "skipstr". That is, the end-of-string is not skipped in the initial scan, but will stop the copying of characters into "arg".
The value returned, "newpos", is the index of the character that stopped the scan. If you are making successive calls to SCAN in order to break "string" up into separate tokens, you should be a little careful when passing the "newpos" from one call as the "pos" for the next call. If the character in "newpos" is in "stopstr" but not in "skipstr", it may be necessary to add one to the old "newpos" before passing it as a "pos".
Copyright © 1996, Thinkage Ltd.