$Sir Wild: Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 4: | Line 4: | ||
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Wild function is the [[RegexMatch (String function)]].</p> | <p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Wild function is the [[RegexMatch (String function)]].</p> | ||
$Sir_Wild indicates whether the one string matches a Sirius-style pattern where a "*" matches any set of characters, a "?" matches any single character and a """ indicates that the following character is to be treated as a literal even if it is one of the three special wildcard characters, that is "*", "?" or """. $Sir_Wild takes two string arguments and returns either a 0 or 1. | <var>$Sir_Wild</var> indicates whether the one string matches a Sirius-style pattern where a "*" matches any set of characters, a "?" matches any single character and a """ indicates that the following character is to be treated as a literal even if it is one of the three special wildcard characters, that is "*", "?" or """. $Sir_Wild takes two string arguments and returns either a 0 or 1. | ||
The first argument is the string to be tested for a match. This is an optional argument and defaults to null. | The first argument is the string to be tested for a match. This is an optional argument and defaults to null. | ||
Line 17: | Line 17: | ||
<p class="caption"> %RC is set to 0 or 1.</p> | <p class="caption"> %RC is set to 0 or 1.</p> | ||
$Sir_Wild returns either a 1 indicating that the first string matches the second or 0 otherwise. For example, this returns 1: | <var>$Sir_Wild</var> returns either a 1 indicating that the first string matches the second or 0 otherwise. For example, this returns 1: | ||
<p class="code"> $Sir_Wild('Ahab', 'A*') | <p class="code"> $Sir_Wild('Ahab', 'A*') | ||
Line 32: | Line 32: | ||
</p> | </p> | ||
$Sir_Wild is new in Version 6.3 of the <var class="product">[[Sirius Mods]]</var>. | <var>$Sir_Wild</var> is new in Version 6.3 of the <var class="product">[[Sirius Mods]]</var>. | ||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> |
Revision as of 23:44, 18 October 2012
Test string against a wildcard string
Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Sir_Wild function is the RegexMatch (String function).
$Sir_Wild indicates whether the one string matches a Sirius-style pattern where a "*" matches any set of characters, a "?" matches any single character and a """ indicates that the following character is to be treated as a literal even if it is one of the three special wildcard characters, that is "*", "?" or """. $Sir_Wild takes two string arguments and returns either a 0 or 1.
The first argument is the string to be tested for a match. This is an optional argument and defaults to null.
The second argument is the string, possibly containing wildcards, against which the first argument is to be tested. This is an optional argument and defaults to null.
Syntax
<section begin="syntax" />%rc = $Sir_Wild(string, wildcard) <section end="syntax" />
$Sir_Wild returns either a 1 indicating that the first string matches the second or 0 otherwise. For example, this returns 1:
$Sir_Wild('Ahab', 'A*')
This returns 0:
$Sir_Wild('Starbuck', 'A*')
This returns 1:
$Sir_Wild('*LOOK', '"*LOO?')
$Sir_Wild is new in Version 6.3 of the Sirius Mods.