NextChar (StringTokenizer function): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:StringTokenizer:NextChar subtitle}} | |||
This method returns the value of the character that is at the tokenizing position, | 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. | and it advances the tokenizing position past that character to the next character. | ||
The tokenizing position is the value returned by [[NextPosition (StringTokenizer property)|NextPosition]]. | The tokenizing position is the value returned by [[NextPosition (StringTokenizer property)|NextPosition]]. | ||
==Syntax== | |||
{{Template:StringTokenizer:NextChar syntax}} | |||
===Syntax terms=== | ===Syntax terms=== | ||
<dl> | <dl> | ||
Line 20: | Line 14: | ||
</dl> | </dl> | ||
==Usage notes== | |||
<ul> | <ul> | ||
<li>If the value of [[AtEnd (StringTokenizer function)|AtEnd]] is <tt>True</tt>, | <li>If the value of [[AtEnd (StringTokenizer function)|AtEnd]] is <tt>True</tt>, | ||
Line 29: | Line 23: | ||
next character, but it does not advance the tokenizing position. | next character, but it does not advance the tokenizing position. | ||
</ul> | </ul> | ||
==Examples== | |||
The following sequence of printText statements display, | The following sequence of printText statements display, | ||
Line 42: | Line 36: | ||
Print %tok:peekChar | Print %tok:peekChar | ||
</pre> | </pre> | ||
==See also== | |||
{{Template:StringTokenizer:NextChar footer}} |
Revision as of 19:54, 6 February 2011
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.
Syntax
%string = stringTokenizer:NextChar
Syntax terms
- %string
- A string variable to receive the returned character value.
- %tok
- A StringTokenizer object variable.
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.
Examples
The following sequence of printText 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