$ListFind: Difference between revisions
(Created page with "{{DISPLAYTITLE:$ListFind}} <span class="pageSubtitle"><section begin="desc" />Find string in $list<section end="desc" /></span> <p class="warning">Most Sirius $functions have be...") |
(Automatically generated page update) |
||
(41 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$ListFind}} | {{DISPLAYTITLE:$ListFind}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Find string in $list</span> | ||
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListFind function are the [[Find and FindUp (Stringlist functions)|Find and FindUp]] functions.</p> | |||
This function locates a $list item that exactly matches a specified string. | This function locates a $list item that exactly matches a specified string. | ||
The $ListFind function accepts three arguments and returns the item number of the $list item that matches the string or an error code. It is a callable $function | The <var>$ListFind</var> function accepts three arguments and returns the item number of the $list item that matches the string or an error code. It is a [[Calling Sirius Mods $functions|callable]] $function. | ||
The first argument is the identifier of the $list in which a string is to be located. This is a required argument. | The first argument is the identifier of the $list in which a string is to be located. This is a required argument. | ||
Line 15: | Line 14: | ||
The third argument is a number that indicates the item number at which the search is to begin. If this argument is not specified searching begins at the first item in the $list. | The third argument is a number that indicates the item number at which the search is to begin. If this argument is not specified searching begins at the first item in the $list. | ||
==Syntax== | ==Syntax== | ||
<p class="syntax" | <p class="syntax">[%RESULT =] $ListFind(list_identifier, search_string, start_item) | ||
start_item) | |||
</p> | </p> | ||
<p class=" | |||
<p class="code"> | <p><var class="term">%result</var> is set either to the item number of the first item in the $list that matches the search criteria, or to a negative number if an error has occurred.</p> | ||
===Error codes=== | |||
<p class="code">-5 - Required argument not specified | |||
-6 - $List identifier invalid | |||
-7 - Item number not found in $list | |||
-8 - String not found (if $list empty, -7) | |||
</p> | </p> | ||
==Usage notes== | |||
<ul> | |||
<li>The difference between <var>$ListFind</var> and [[$ListLoc]] is that with $ListFind, a $list item must match the search string exactly rather than simply containing the search string. Moreover, <var>$ListFind</var> does not allow specification of a range of columns (or positions) that are to be searched. | |||
</ul> | |||
==Products authorizing {{PAGENAMEE}}== | |||
<ul class="smallAndTightList"> | <ul class="smallAndTightList"> | ||
<li>[[Sirius functions]]</li> | <li>[[List of $functions|Sirius functions]]</li> | ||
<li>[[Fast/Unload User Language Interface]]</li> | <li>[[Fast/Unload User Language Interface]]</li> | ||
<li>[[Janus Open Client]]</li> | <li>[[Media:JoclrNew.pdf|Janus Open Client]]</li> | ||
<li>[[Janus Open Server]]</li> | <li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li> | ||
<li>[[Janus Sockets]]</li> | <li>[[Janus Sockets]]</li> | ||
<li>[[Janus Web Server]]</li> | <li>[[Janus Web Server]]</li> | ||
<li> | <li>Japanese functions</li> | ||
<li>[[Sir2000 Field Migration Facility]]</li> | <li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li> | ||
</ul> | </ul> | ||
[[Category:$Functions|$ListFind]] | [[Category:$Functions|$ListFind]] |
Latest revision as of 22:51, 20 September 2018
Find string in $list
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $ListFind function are the Find and FindUp functions.
This function locates a $list item that exactly matches a specified string.
The $ListFind function accepts three arguments and returns the item number of the $list item that matches the string or an error code. It is a callable $function.
The first argument is the identifier of the $list in which a string is to be located. This is a required argument.
The second argument is the string to be matched. This is a required argument.
The third argument is a number that indicates the item number at which the search is to begin. If this argument is not specified searching begins at the first item in the $list.
Syntax
[%RESULT =] $ListFind(list_identifier, search_string, start_item)
%result is set either to the item number of the first item in the $list that matches the search criteria, or to a negative number if an error has occurred.
Error codes
-5 - Required argument not specified -6 - $List identifier invalid -7 - Item number not found in $list -8 - String not found (if $list empty, -7)
Usage notes
- The difference between $ListFind and $ListLoc is that with $ListFind, a $list item must match the search string exactly rather than simply containing the search string. Moreover, $ListFind does not allow specification of a range of columns (or positions) that are to be searched.