NextChar (StringTokenizer function)

From m204wiki
Revision as of 23:16, 5 July 2012 by JAL2 (talk | contribs)
Jump to navigation Jump to search

Value of character at current tokenizing position (StringTokenizer class)

This method returns the value of the character that is at the tokenizing position, and it advances the tokenizing position past that character to the next character. The tokenizing position is the value returned by NextPosition.


%string = stringTokenizer:NextChar

Syntax terms

%string A string variable to receive the returned character value.
stringTokenizer A StringTokenizer object.

Usage notes

  • If the value of AtEnd is True, issuing NextChar is invalid and cancels the request.
  • Once NextChar executes, the number of the resulting position can be returned by NextPosition.
  • The PeekChar function also returns the value of the next character, but it does not advance the tokenizing position.


The following sequence of Print statements display, respectively, E, x, a, and a, showing that the tokenizing position moves after NextChar completes but not after PeekChar completes:

%tok:string = 'Example of peekChar' Print %tok:nextChar Print %tok:nextChar Print %tok:peekChar Print %tok:peekChar

See also