TokensToUpper (StringTokenizer property)

From m204wiki
Revision as of 20:59, 15 November 2012 by JAL (talk | contribs) (→‎Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Convert returned tokens to all-uppercase (StringTokenizer class)


This readWrite property returns or sets the Boolean value that indicates whether to convert returned, non-quoted, tokens to all-uppercase characters. The default value for a new tokenizer is False.

Syntax

%currentBoolean = stringTokenizer:TokensToUpper stringTokenizer:TokensToUpper = newBoolean

Syntax terms

%currentBoolean An Boolean enumeration object to contain the returned value of TokensToUpper.
stringTokenizer A StringTokenizer object.
newBoolean The Boolean value to assign to stringTokenizer's TokensToUpper property. Setting it to true causes tokens to be uppercased when returned, and the TokensToLower property to be ignored.

Usage notes

  • TokensToUpper has no effect on non-alphabetic characters.
  • The TokensToLower property specifies or reports whether returned tokens are to be converted to lowercase characters; however, if TokensToUpper is true, then TokensToLower is ignored.

Examples

In the following example, the input string's tokens are returned in sequence under the default (False) setting of TokensToUpper:

%tok is object stringtokenizer %tok = new %tok:string = 'Bad,F ?3mO ,7,{x Z}' repeat while not %tok:atEnd printText {~} is {%tok:nextToken} end repeat

The resulting tokens are:

%tok:nextToken is Bad,F %tok:nextToken is ?3mO %tok:nextToken is ,7,{x %tok:nextToken is Z}

If %tok:tokensToUpper = true is specified for the object, the resulting tokens are:

%tok:nextToken is BAD,F %tok:nextToken is ?3MO %tok:nextToken is ,7,{X %tok:nextToken is Z}

See also