QuotesBreak (StringTokenizer property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 10: Line 10:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%boolean</th>
<tr><th>%currentBoolean</th>
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>CurrentQuoted</var>. The default value is <var>True</var>.
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>CurrentQuoted</var>. The default value is <var>True</var>.


Line 17: Line 17:
<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>%currentBoolean</th>
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>CurrentQuoted</var>. The default value is <var>True</var>.
</table>
</table>



Revision as of 00:01, 5 July 2012

Do quotes break the current token? (StringTokenizer class)

[Introduced in Sirius Mods 7.8]


QuotesBreak determines whether quotes are considered boundaries of tokens. The string peanut"butter" will tokenize to peanut and butter when QuotesBreak is true. Otherwise it will tokenize to peanutbutter (assuming RemoveQuotes is set).

Syntax

%currentBoolean = stringTokenizer:QuotesBreak stringTokenizer:QuotesBreak = newBoolean

Syntax terms

%currentBoolean An enumeration object of type Boolean to contain the returned value of CurrentQuoted. The default value is True. For more information about Boolean enumerations, see "Using Boolean Enumerations".
stringTokenizer A StringTokenizer object expression.
%currentBoolean An enumeration object of type Boolean to contain the returned value of CurrentQuoted. The default value is True.

Usage notes

  • The Quotes characters are initially settable in the New call that creates the tokenizer instance.
  • The RemoveQuotes property controls whether quotes are removed from the returned values of quoted tokens.

Examples

In this example, the string fire"works" is either one or two tokens, depending on the setting of QuotesBreak:

b %tok is object StringTokenizer %tok = new(quotes='"') %tok:string = 'fire"works"' PrintText {~} is: {%tok:quotesbreak} repeat while %tok:notAtEnd printtext {~} = {%tok:nextToken} end repeat %tok:string = 'fire"works"' %tok:quotesbreak = False PrintText {~} is: {%tok:quotesbreak} repeat while %tok:notAtEnd printtext {~} = {%tok:nextToken} end repeat end

The result is:

%tok:quotesbreak is: True %tok:nextToken = fire %tok:nextToken = works %tok:quotesbreak is: False %tok:nextToken = fireworks

See also