StartOfString (StringTokenizer function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Substring that precedes first character of current token</b></span>
{{Template:StringTokenizer:StartOfString subtitle}}
[[Category:StringTokenizer methods|StartOfString function]]
<!--DPL?? Category:StringTokenizer methods|StartOfString function: Substring that precedes first character of current toke-->
<!--DPL?? Category:System methods|StartOfString (StringTokenizer function): Substring that precedes first character of current toke-->
<p>
StartOfString is a member of the [[StringTokenizer class]].
</p>


This method returns the substring of the tokenizer string
This method returns the substring of the tokenizer string
that precedes the first character of the current token.
that precedes the first character of the current token.
===Syntax===
==Syntax==
  %string = %tok:StartOfString
{{Template:StringTokenizer:StartOfString syntax}}
===Syntax terms===
===Syntax terms===
<dl>
<dl>
Line 19: Line 13:


</dl>
</dl>
===Usage Notes===
==Usage notes==
<ul>
<ul>
<li>StartOfString does not advance the position.
<li>StartOfString does not advance the position.
Line 32: Line 26:
present tokenizing position.
present tokenizing position.
</ul>
</ul>
===Examples===
==Examples==


The following request fragment shows that consecutive StartOfString statements
The following request fragment shows that consecutive StartOfString statements
Line 48: Line 42:
     A StartOfString \\
     A StartOfString \\
</pre>
</pre>
==See also==
{{Template:StringTokenizer:StartOfString footer}}

Revision as of 19:54, 6 February 2011

Substring that precedes first character of current token (StringTokenizer class)


This method returns the substring of the tokenizer string that precedes the first character of the current token.

Syntax

%string = stringTokenizer:StartOfString

Syntax terms

%string
A string variable to receive the characters that precede the current position.
%tok
A StringTokenizer object variable.

Usage notes

  • StartOfString does not advance the position.
  • The substring returned by StartOfString ends at (but does not include) the first character of the current token, the position of which is the value of CurrentTokenPosition. The value of the current token is returned by CurrentToken.
  • StartOfString returns a null string if it is issued before a token is found or if the value of NextPosition is 1.
  • The RestOfString function returns the substring of the tokenizer string that follows the present tokenizing position.

Examples

The following request fragment shows that consecutive StartOfString statements do not advance the position:

    %tok:string = 'A StartOfString example'
    %tok:findToken:('example')
    printText {%tok:startOfString}
    printText {%tok:startOfString}\\

The result is:

    A StartOfString
    A StartOfString \\

See also