TokensToUpper (StringTokenizer property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (fix "using boolean enumerations" link)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Template:StringTokenizer:TokensToUpper subtitle}}
{{Template:StringTokenizer:TokensToUpper subtitle}}


This readWrite property returns or sets the Boolean value that indicates
This readWrite property returns or sets the <var>[[Boolean enumeration|Boolean]]</var> value that indicates
whether to convert returned, non-quoted, tokens to all-uppercase characters.
whether to convert returned, non-quoted, tokens to all-uppercase characters.
The default value for a new tokenizer is <code>False</code>.
The default value for a new tokenizer is <var>False</var>.


==Syntax==
==Syntax==
{{Template:StringTokenizer:TokensToUpper syntax}}
{{Template:StringTokenizer:TokensToUpper syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%currentBoolean</th>
<tr><th>%currentBoolean</th>
<td>An <var> Boolean </var> enumeration object to contain the returned value of <var>TokensToUpper</var>. For more information about Boolean enumerations, see [[Enumerations#Using_Boolean_enumerations|"Using Boolean Enumerations"]].</td></tr>
<td>An <var> Boolean </var> enumeration object to contain the returned value of <var>TokensToUpper</var>. </td></tr>
 
<tr><th>stringTokenizer</th>
<tr><th>stringTokenizer</th>
<td>A <var>StringTokenizer</var> object expression.</td></tr>
<td>A <var>StringTokenizer</var> object.</td></tr>
 
<tr><th>newBoolean</th>
<tr><th>newBoolean</th>
<td> The <var>Boolean</var> value to assign to <var class="term">stringTokenizer</var>'s <var>Editing TokensToUpper</var> property.</td></tr>
<td> The <var>Boolean</var> value to assign to <var class="term">stringTokenizer</var>'s <var>TokensToUpper</var> property.  Setting it to <code>true</code> causes tokens to be uppercased when returned, and the <var>TokensToLower</var> property to be ignored.</td></tr>
</table>
</table>


Line 20: Line 23:
<ul>
<ul>
<li><var>TokensToUpper</var> has no effect on non-alphabetic characters.
<li><var>TokensToUpper</var> has no effect on non-alphabetic characters.
<li>The [[TokensToLower (StringTokenizer property)|TokensToLower]] property specifies or reports whether
<li>The <var>[[TokensToLower (StringTokenizer property)|TokensToLower]]</var> property specifies or reports whether
returned tokens are to be converted to lowercase characters.
returned tokens are to be converted to lowercase characters; however, if <var>TokensToUpper</var> is <code>true</code>, then <var>TokensToLower</var> is ignored.
</ul>
</ul>
==Examples==
==Examples==
 
In the following example, the input string's tokens are returned in sequence
In the following example,
under the default (<var>False</var>) setting of <var>TokensToUpper</var>:
the input string's tokens are returned in sequence
under the default (<code>False</code>) setting of <var>TokensToUpper</var>:
<p class="code">%tok is object stringtokenizer
<p class="code">%tok is object stringtokenizer
%tok = new
%tok = new
%tok:string = 'Bad,F  ?3mO ,7,{x Z}'
%tok:string = 'Bad,F  ?3mO ,7,{x Z}'
repeat while not %tok:atEnd
repeat while not %tok:atEnd
   printText {~} is {%tok:nextToken}
   [[Targeted Text statements#AuditText, PrintText, and TraceText|printText]] {~} is {%tok:nextToken}
end repeat
end repeat
</p>
</p>
Line 43: Line 45:
</p>
</p>


If <tt>%tok:TokensToUpper = True</tt> is specified for the instantiated object,
If <code>%tok:tokensToUpper = true</code> is specified for the object,
the resulting tokens are:
the resulting tokens are:
<p class="code">%tok:nextToken is BAD,F
<p class="code">%tok:nextToken is BAD,F

Latest revision as of 20:59, 15 November 2012

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