TokenEnd()
Check whether additional tokens are available with TOKENNEXT()
Syntax
TokenEnd( [<@cTokenEnvironment>] ) -> lTokenEnd
Arguments
<@cTokenEnvironment> a token environment
Returns
<lTokenEnd> .T., if additional tokens are available
Description
The TokenEnd() function can be used to check whether the next call to TOKENNEXT() would return a new token. This can not be decided with TOKENNEXT() alone, since an empty token cannot be distinguished from a “no more” tokens.
If the parameter <@cTokenEnvironment> is supplied (must be by reference), the information from this token environment is used, otherwise the global TE is used.
With a combination of TokenEnd() and TOKENNEXT(), all tokens from a string can be retrieved successivly (see example).
Examples
tokeninit( "a.b.c.d", ".", 1 ) // initialize global token environment DO WHILE ! TokenEnd() ? tokennext( "a.b.c.d" ) // get all tokens successivly ENDDO
Compliance
TokenEnd() is compatible with CT3’s TokenEnd(), but there are is an additional parameter featuring local token environments.
Platforms
All
Files
Source is token2.c, library is libct.
Seealso
TOKENINIT(), TOKENEXIT(), TOKENNEXT(), TOKENNUM(), TOKENAT(), SAVETOKEN(), RESTTOKEN()
Pingback: Harbour String Functions | Viva Clipper !
Pingback: Harbour All Functions – T | Viva Clipper !