Quotes (StringTokenizer property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
 
(One intermediate revision by one other user not shown)
Line 5: Line 5:
The text between each disjoint pair of identical quotation characters
The text between each disjoint pair of identical quotation characters
(a "quoted region") is treated as a single token, and any
(a "quoted region") is treated as a single token, and any
delimiter characters (<var>Quotes</var>, <var>[[Spaces (StringTokenizer property)|Spaces]]</var>, or <var>[[TokenChars (StringTokenizer property)|TokenChars]]</var>)
delimiter characters (<var>Quotes</var>, <var>[[Spaces (StringTokenizer property)|Spaces]]</var>, <var>[[TokenChars (StringTokenizer property)|TokenChars]]</var>, or <var>[[Separators (StringTokenizer property)|Separators]]</var>)
within a quoted region are treated as non-delimiters.
within a quoted region are treated as non-delimiters.
   
   
==Syntax==
==Syntax==
{{Template:StringTokenizer:Quotes syntax}}
{{Template:StringTokenizer:Quotes syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%currentString</th>
<tr><th>%currentString</th>
<td>A string variable to contain the returned value of the current quotation characters.
<td>A string variable to contain the returned value of the current quotation characters.
<tr><th>stringTokenizer</th>
<tr><th>stringTokenizer</th>
<td>A <var>StringTokenizer</var> object expression.</td></tr>
<td>A <var>StringTokenizer</var> object expression.</td></tr>
<tr><th>newString</th>
<tr><th>newString</th>
<td>The string value to assign to <var class="term">stringTokenizer</var>'s <var>Quotes</var> property. Each character in the string is a quotation character and no character may repeat. The default value for a new tokenizer is a null string.
<td>The string value to assign to <var class="term">stringTokenizer</var>'s <var>Quotes</var> property. Each character in the string is a quotation character and no character may repeat. The default value for a new tokenizer is a null string.
Line 25: Line 28:
<li>No character can be one of the <var>Quotes</var> characters and also be
<li>No character can be one of the <var>Quotes</var> characters and also be
one of either the <var>Spaces</var> characters or the <var>TokenChars</var> characters.
one of either the <var>Spaces</var> characters or the <var>TokenChars</var> characters.
<li>The <var>Quotes</var> characters are initially settable in the [[New (StringTokenizer constructor)|New]] call that creates the tokenizer instance.
 
<li>The <var>Quotes</var> characters are initially settable in the <var>[[New (StringTokenizer constructor)|New]]</var> call that creates the tokenizer instance.
 
<li>A quotation character may participate in only one quoted region.
<li>A quotation character may participate in only one quoted region.
The first quotation character from the beginning of the tokenization string is
The first quotation character from the beginning of the tokenization string is
paired with the following identical quotation character in the string.
paired with the following identical quotation character in the string.
An unpaired quotation character causes a request cancellation.
An unpaired quotation character causes a request cancellation.
<li>A quoted region is not affected by the <var>[[TokensToLower (StringTokenizer property)|TokensToLower]]</var>
<li>A quoted region is not affected by the <var>[[TokensToLower (StringTokenizer property)|TokensToLower]]</var>
and <var>[[TokensToUpper (StringTokenizer property)|TokensToUpper]]</var> properties.
and <var>[[TokensToUpper (StringTokenizer property)|TokensToUpper]]</var> properties.
<li>The <var>[[RemoveQuotes (StringTokenizer property)|RemoveQuotes]]</var> property controls whether
<li>The <var>[[RemoveQuotes (StringTokenizer property)|RemoveQuotes]]</var> property controls whether
quotes are removed from the returned values of quoted tokens.
quotes are removed from the returned values of quoted tokens.
</ul>
</ul>
==Examples==
==Examples==
The following request fragment employs two quotation characters, and
The following request fragment employs two quotation characters, and
it uses the <var>RemoveQuotes</var> method to include the quotation characters
it uses the <var>RemoveQuotes</var> method to include the quotation characters
Line 53: Line 60:
"trivial"
"trivial"
</p>
</p>
==See also==
==See also==
{{Template:StringTokenizer:Quotes footer}}
{{Template:StringTokenizer:Quotes footer}}

Latest revision as of 20:36, 15 November 2012

Characters to be interpreted as quotes (StringTokenizer class)


This readWrite property returns or sets the characters that are recognized as quotation characters. The text between each disjoint pair of identical quotation characters (a "quoted region") is treated as a single token, and any delimiter characters (Quotes, Spaces, TokenChars, or Separators) within a quoted region are treated as non-delimiters.

Syntax

%currentString = stringTokenizer:Quotes stringTokenizer:Quotes = newString

Syntax terms

%currentString A string variable to contain the returned value of the current quotation characters.
stringTokenizer A StringTokenizer object expression.
newString The string value to assign to stringTokenizer's Quotes property. Each character in the string is a quotation character and no character may repeat. The default value for a new tokenizer is a null string.

Usage notes

  • No character can be one of the Quotes characters and also be one of either the Spaces characters or the TokenChars characters.
  • The Quotes characters are initially settable in the New call that creates the tokenizer instance.
  • A quotation character may participate in only one quoted region. The first quotation character from the beginning of the tokenization string is paired with the following identical quotation character in the string. An unpaired quotation character causes a request cancellation.
  • A quoted region is not affected by the TokensToLower and TokensToUpper properties.
  • The RemoveQuotes property controls whether quotes are removed from the returned values of quoted tokens.

Examples

The following request fragment employs two quotation characters, and it uses the RemoveQuotes method to include the quotation characters in the returned tokens:

%tok = new(Quotes='"+') %tok:string = '+This Quotes example+ is "trivial"' %tok:removeQuotes = False Print %tok:nextToken Print %tok:nextToken Print %tok:nextToken

The result is:

+This Quotes example+ is "trivial"

See also