QuotesBreak (StringTokenizer property): Difference between revisions
mNo edit summary |
m (→Syntax terms) |
||
(One intermediate revision by one other user not shown) | |||
Line 2: | Line 2: | ||
<var>[[QuotesBreak (StringTokenizer property)|QuotesBreak]]</var> determines whether quotes are considered | <var>[[QuotesBreak (StringTokenizer property)|QuotesBreak]]</var> determines whether quotes are considered | ||
boundaries of tokens | boundaries of tokens, that is, whether in the simplest case, the string <code>peanut"butter"</code> will tokenize to <code>peanut</code> and <code>butter</code> or to <code>peanutbutter</code>. | ||
<code>butter</code> | |||
==Syntax== | ==Syntax== | ||
Line 12: | Line 10: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%currentBoolean</th> | <tr><th>%currentBoolean</th> | ||
<td>An enumeration object of type <var>Boolean</var> to contain the returned value of <var>QuotesBreak</var>. The default value is <var>True</var>. | <td>An enumeration object of type <var>[[Boolean enumeration|Boolean]]</var> to contain the returned value of <var>QuotesBreak</var>. The default value is <var>True</var>. | ||
</td></tr> | |||
<tr><th>stringTokenizer</th> | <tr><th>stringTokenizer</th> |
Latest revision as of 20:43, 15 November 2012
Do quotes break the current token? (StringTokenizer class)
[Introduced in Sirius Mods 7.8]
QuotesBreak determines whether quotes are considered
boundaries of tokens, that is, whether in the simplest case, the string peanut"butter"
will tokenize to peanut
and butter
or to peanutbutter
.
Syntax
%currentBoolean = stringTokenizer:QuotesBreak stringTokenizer:QuotesBreak = newBoolean
Syntax terms
%currentBoolean | An enumeration object of type Boolean to contain the returned value of QuotesBreak. The default value is True. |
---|---|
stringTokenizer | A StringTokenizer object expression. |
newBoolean | A Boolean enumeration value. |
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