PeekChar (StringTokenizer function): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:StringTokenizer:PeekChar subtitle}} | |||
This method returns the value of | This method returns the value of | ||
Line 14: | Line 8: | ||
tokenizing position, | tokenizing position, | ||
which remains what it was when PeekChar was called. | which remains what it was when PeekChar was called. | ||
==Syntax== | |||
{{Template:StringTokenizer:PeekChar syntax}} | |||
===Syntax terms=== | ===Syntax terms=== | ||
<dl> | <dl> | ||
Line 25: | Line 19: | ||
</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 32: | Line 26: | ||
next character, but it advances the tokenizing position past the next character. | next character, but it advances the tokenizing position past the next character. | ||
</ul> | </ul> | ||
==Examples== | |||
The following sequence of printText statements display, | The following sequence of printText statements display, | ||
Line 46: | Line 40: | ||
printText {%tok:nextChar} | printText {%tok:nextChar} | ||
</pre> | </pre> | ||
==See also== | |||
{{Template:StringTokenizer:PeekChar footer}} |
Revision as of 19:54, 6 February 2011
Value of character at current tokenizing position, do not advance (StringTokenizer class)
This method returns the value of
the character that is at the tokenizing position.
The tokenizing position is the value returned by NextPosition.
After returning the character value, PeekChar does not advance the tokenizing position, which remains what it was when PeekChar was called.
Syntax
%string = stringTokenizer:PeekChar
Syntax terms
- %string
- A string variable to receive the value of the character at the tokenizing position.
- %tok
- A StringTokenizer object variable.
Usage notes
- If the value of AtEnd is True, issuing PeekChar is invalid and cancels the request.
- The NextChar function also returns the value of the next character, but it advances the tokenizing position past the next character.
Examples
The following sequence of printText statements display, respectively, A, A, A, and n, showing that the tokenizing position does not move after PeekChar completes, PeekChar and NextChar return the same value, and NextChar does advance the tokenizing position:
%tok:string = 'An example of peekChar' printText {%tok:peekChar} printText {%tok:peekChar} printText {%tok:nextChar} printText {%tok:nextChar}