home *** CD-ROM | disk | FTP | other *** search
- * The source code provided herein remains the property of Rick
- * Spence and Software Design Consultants. You are, however, free to
- * use it, but please do not republish.
-
-
- * RICKP.PRG
- *
- * Rick Spence's Clipper Code fropm the Advanced C presentation,
- * 1990 Devcon
-
- * Program 9 - 6 Tokenizing Functions
-
- #define VOID .T.
-
- STATIC _token_string, _separators
-
- FUNCTION tok_start(tok_str, seps)
-
- _token_string = tok_str
- _separators = seps
-
- RETURN VOID
-
-
- FUNCTION next_tok(token)
-
- LOCAL where_sep, ret_val
-
- ret_val = .F.
- IF !(_token_string == "")
- where_sep = cstrcspn(_token_string, _separators)
- DO WHILE where_sep = 1
- _token_string = substr(_token_string, 2)
- where_sep = cstrcspn(_token_string, _separators)
- ENDDO
-
- IF where_sep > 1
- token = substr(_token_string, 1, where_sep - 1)
- _token_string = substr(_token_string, where_sep + 1)
- ret_val = .T.
- ENDIF
- ENDIF
-
- RETURN ret_val
-