[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
TOKENAT()
Determines the most recent TOKENNEXT() position within a string
------------------------------------------------------------------------------
Syntax
TOKENAT(<lLastTokenPos>) --> nPosition
Argument
<lLastTokenPos> When designated as .T., this parameter returns the
delimiter position after the last token found.
Returns
TOKENAT() returns the beginning position of the token most recently
returned using TOKENNEXT(). If TOKENINIT() and TOKENNEXT() have not
been called prior to calling TOKENAT(), the function returns 0.
Description
TOKENAT() returns the starting position of the token most recently
extracted by TOKENNEXT(). If TOKENAT() is used in conjunction with
SUBSTR(), the delimiters before the token in an incremental tokenizer
are available. To determine the delimiter position before the last
token, set TOKENAT() to -1. To determine the delimiter position after
the last token, set TOKENAT to .T..
Please notice that the character string initialized by TOKENINIT() no
longer contains the original delimiters. If you need the original
delimiters, you should make a copy before you call TOKENINIT().
Example
This example shows five tokens and their starting positions:
cString := "This is a search, 234"
cCopy := String
TOKENINIT(@cString)
? TOKENNEXT(), TOKENAT() // "This", 1
? TOKENNEXT(), TOKENAT() // "is", 6
? TOKENNEXT(), TOKENAT() // "a", 9
? TOKENNEXT(), TOKENAT() // "search", 11
? TOKENNEXT(), TOKENAT() // "234", 18
? SUBSTR(cCOPY, TOKENAT() -1, 1 // Delimiter : ","
See Also:
TOKENINIT()
TOKENNEXT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson