PreviousChar (StringTokenizer function): Difference between revisions
m (→Syntax terms) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:StringTokenizer:PreviousChar subtitle}} | {{Template:StringTokenizer:PreviousChar subtitle}} | ||
This | This method returns the value of the character that precedes the character that is at the tokenizing position, | ||
and it steps the tokenizing position back to the preceding character. | |||
The tokenizing position is the value returned by <var>[[NextPosition (StringTokenizer property)|NextPosition]]</var>. | |||
==Syntax== | ==Syntax== | ||
{{Template:StringTokenizer:PreviousChar syntax}} | {{Template:StringTokenizer:PreviousChar syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
Line 13: | Line 17: | ||
==Usage notes== | ==Usage notes== | ||
<ul> | |||
<li>The <var>[[PeekPreviousChar (StringTokenizer function)|PeekPreviousChar]]</var> function also returns the value of the | |||
next character, but it does not step back the tokenizing position. | |||
</ul> | |||
==Examples== | ==Examples== | ||
The following sequence of <var>PrintText</var> statements display, | |||
respectively, <code>Example</code>, <code>e</code>, <code>l</code>, <code>p</code>, and <code>p</code>, | |||
showing that the tokenizing position moves after <var>PreviousChar</var> completes | |||
but not after <var>PeekPreviousChar</var> completes: | |||
<p class="code">%tok:string = 'Example of peekPreviousChar' | |||
PrintText {~} is {%tok:nextToken} | |||
PrintText {~} is {%tok:previousChar} | |||
PrintText {~} is {%tok:previousChar} | |||
PrintText {~} is {%tok:peekPreviousChar} | |||
PrintText {~} is {%tok:peekPreviousChar} | |||
</p> | |||
==See also== | ==See also== | ||
{{Template:StringTokenizer:PreviousChar footer}} | {{Template:StringTokenizer:PreviousChar footer}} |
Revision as of 18:24, 5 July 2012
Value of previous character and step back one position (StringTokenizer class)
[Introduced in Sirius Mods 7.8]
This method returns the value of the character that precedes the character that is at the tokenizing position,
and it steps the tokenizing position back to the preceding character.
The tokenizing position is the value returned by NextPosition.
Syntax
%string = stringTokenizer:PreviousChar
Syntax terms
%string | A string variable to receive the returned character value. |
---|---|
stringTokenizer | A StringTokenizer object variable. |
Usage notes
- The PeekPreviousChar function also returns the value of the next character, but it does not step back the tokenizing position.
Examples
The following sequence of PrintText statements display,
respectively, Example
, e
, l
, p
, and p
,
showing that the tokenizing position moves after PreviousChar completes
but not after PeekPreviousChar completes:
%tok:string = 'Example of peekPreviousChar' PrintText {~} is {%tok:nextToken} PrintText {~} is {%tok:previousChar} PrintText {~} is {%tok:previousChar} PrintText {~} is {%tok:peekPreviousChar} PrintText {~} is {%tok:peekPreviousChar}