CT_RESTTOKEN

 RESTTOKEN()
 Recreates an incremental tokenizer environment
------------------------------------------------------------------------------
 Syntax

     RESTTOKEN(<cTokenEnvironment>) --> cEmptyString

 Argument

     <cTokenEnvironment>  Designates a character string returned by the
     SAVETOKEN() function.

 Returns

     RESTTOKEN() always returns an empty string.

 Description

     The internal environment for the incremental tokenizer can be restored
     using RESTTOKEN().  RESTTOKEN() does the opposite of the SAVETOKEN()
     function.

 Note

     .  <nTokenEnvironment> must originate from the current program
        run; for example, it cannot have been restored from a (.mem) file.

 Examples

     .  Here is an incremental tokenizer.  Text is broken into
        individual lines, and each line is broken into words:

        TOKENINIT(@cTextString, CHR(13) + CHR(10), 2)
        cLine   :=  TOKENNEXT()

        DO WHILE .NOT. TOKENEND()
           cLine  :=  TOKENNEXT(cTextString)
           WORD(cLine)
        ENDDO

     .  The function then breaks the lines into words:

        FUNCTION WORD(cLine)

           cOldEnv  := SAVETOKEN()
           TOKENINIT(@cLine, " .,-:;")

           DO WHILE .NOT. TOKENEND()
              cWord  :=  TOKENNEXT(cLine)
              ? cWord
           ENDDO
           RESTTOKEN(cOldEnv)
           RETURN("")

See Also: SAVETOKEN() TOKENINIT() TOKENNEXT()

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.