NextChar (StringTokenizer function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
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 <var>[[NextPosition (StringTokenizer property)|NextPosition]]</var>. | ||
==Syntax== | ==Syntax== | ||
{{Template:StringTokenizer:NextChar syntax}} | {{Template:StringTokenizer:NextChar syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%string</th> | <tr><th>%string</th> | ||
<td>A string variable to receive the returned character value. </td></tr> | <td>A string variable to receive the returned character value. </td></tr> | ||
<tr><th>stringTokenizer</th> | <tr><th>stringTokenizer</th> | ||
<td>A <var>StringTokenizer</var> object | <td>A <var>StringTokenizer</var> object.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>If the value of [[AtEnd (StringTokenizer function)|AtEnd]] is <code>True</code>, | <li>If the value of <var>[[AtEnd (StringTokenizer function)|AtEnd]]</var> is <code>True</code>, issuing <var>NextChar</var> is invalid and cancels the request. | ||
issuing <var>NextChar</var> is invalid and cancels the request. | |||
<li>Once <var>NextChar</var> executes, the number of the resulting position | <li>Once <var>NextChar</var> executes, the number of the resulting position | ||
can be returned by NextPosition. | can be returned by <var>NextPosition</var>. | ||
<li>The [[PeekChar (StringTokenizer function)|PeekChar]] function also returns the value of the | |||
<li>The <var>[[PeekChar (StringTokenizer function)|PeekChar]]</var> function also returns the value of the | |||
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 <var>Print</var> statements display, | The following sequence of <var>Print</var> statements display, | ||
respectively, < | respectively, <code>E</code>, <code>x</code>, <code>a</code>, and <code>a</code>, | ||
showing that the tokenizing position moves after <var>NextChar</var> completes | showing that the tokenizing position moves after <var>NextChar</var> completes | ||
but not after PeekChar completes: | but not after <var>PeekChar</var> completes: | ||
<p class="code">%tok:string = 'Example of peekChar' | <p class="code">%tok:string = 'Example of peekChar' | ||
Print %tok:nextChar | Print %tok:nextChar |
Latest revision as of 19:57, 15 November 2012
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. |
---|---|
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.
Examples=
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