StartOfString (StringTokenizer function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
No edit summary
 
m (1 revision: CharacterMap, RandomNumberGenerator, StringTokenizer methods)
(No difference)

Revision as of 20:15, 16 December 2010

Substring that precedes first character of current toke

StartOfString is a member of the StringTokenizer class.

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

Syntax

  %string = %tok: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 \\