IsOneOf (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Full stop)
m (printtext)
Line 18: Line 18:
==Usage notes==
==Usage notes==
<ul><li>The <var class="term">list</var> argument must be non-null or the request is cancelled.
<ul><li>The <var class="term">list</var> argument must be non-null or the request is cancelled.
<li><var>IsOneOf</var> is available as of <var class="product">Sirius Mods</var> version 7.3.</ul>
<li><var>IsOneOf</var> is available as of <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> version 7.3.</ul>


==Examples==
==Examples==
Line 24: Line 24:
<p class="code">%str is longstring
<p class="code">%str is longstring
%str = 'bleh'
%str = 'bleh'
printText {~} = '{%str:isOneOf('/blah/bleh/blih')}'
[[PrintText statement|printText]] {~} = '{%str:isOneOf('/blah/bleh/blih')}'
printText {~} = '{%str:isOneOf(',blah,bleh,blih')}'
printText {~} = '{%str:isOneOf(',blah,bleh,blih')}'
printText {~} = '{%str:isOneOf('/blah/blh/blih')}'
printText {~} = '{%str:isOneOf('/blah/blh/blih')}'
Line 37: Line 37:
[[Category:String methods|IsOneOf function]]
[[Category:String methods|IsOneOf function]]
==See also==
==See also==
<ul><li>For details of the <var>printtext</var> statement, please see [[Intrinsic classes#printtext|printText]].</ul>
{{Template:String:IsOneOf footer}}
{{Template:String:IsOneOf footer}}

Revision as of 11:42, 22 February 2011

Is the method object string matched by any of the strings in the input list? (String class)


IsOneOf is an intrinsic function that returns a Boolean value that indicates whether the method object string is matched by one of the strings in an input list of strings. The input list of strings is concatenated in a single delimited string argument to the method. A returned value of True signals a successful match.

Syntax

%boolean = string:IsOneOf( list)

Syntax terms

%boolean An enumeration object of type Boolean to contain the returned value of IsOneOf.
string The string to which the method is applied, the maximum length of which is 255 bytes.
list A string that contains a delimited set of potential matching strings for the method object string. The strings in list are separated by a separator character, which must be indicated by the first character of the argument. The separator must be non-alphanumeric. The format of list is therefore:

separatorString1[separatorString2][separatorString3]...

Usage notes

  • The list argument must be non-null or the request is cancelled.
  • IsOneOf is available as of "Sirius Mods" version 7.3.

Examples

  1. The following are IsOneOf sample statements:

    %str is longstring %str = 'bleh' printText {~} = '{%str:isOneOf('/blah/bleh/blih')}' printText {~} = '{%str:isOneOf(',blah,bleh,blih')}' printText {~} = '{%str:isOneOf('/blah/blh/blih')}'

    The results are respectively:

    %str:isOneOf('/blah/bleh/blih') = True %str:isOneOf(',blah,bleh,blih') = True %str:isOneOf('/blah/blh/blih') = False

See also