PeekChar (StringTokenizer function): Difference between revisions
m (→Examples) |
m (→Examples) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
This method returns the value of | This method returns the value of | ||
the character that is at the tokenizing position. | the character that is at the tokenizing position. | ||
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>. | ||
After returning the character value, <var>PeekChar</var> does not advance the | After returning the character value, <var>PeekChar</var> does not advance the | ||
Line 35: | Line 35: | ||
advance the tokenizing position: | advance the tokenizing position: | ||
<p class="code">%tok:string = 'An example of peekChar' | <p class="code">%tok:string = 'An example of peekChar' | ||
[[Targeted Text statements#AuditText, PrintText, and TraceText|PrintText]] {%tok:peekChar} | |||
printText {%tok:peekChar} | printText {%tok:peekChar} | ||
printText {%tok:nextChar} | printText {%tok:nextChar} |
Latest revision as of 20:33, 15 November 2012
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. |
---|---|
stringTokenizer | A StringTokenizer object expression. |
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}