|
|
(5 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| {{Template:Stringlist:LocateUp subtitle}}
| | #REDIRECT [[Locate and LocateUp (Stringlist functions)]] |
| | |
| This method locates a specified string in a <var>stringlist</var>, searching the <var>stringlist</var> items in reverse order.
| |
| | |
| ==Syntax==
| |
| {{Template:Stringlist:LocateUp syntax}}
| |
| ===Syntax terms===
| |
| <table class="syntaxTable">
| |
| <tr><th>%itemnum</th>
| |
| <td>A numeric variable which will be set to the item number of the first item in the <var class="term">sl</var> <var>stringlist</var> that contains the search target string, or it is set to a 0 if no items match the search criterion.</td></tr>
| |
| <tr><th>sl</th>
| |
| <td>A <var>Stringlist</var> object.</td></tr>
| |
| <tr><th>string</th>
| |
| <td>The target string to be located. This is a required argument, and it must be no longer than 255 bytes.</td></tr>
| |
| <tr><th>start</th>
| |
| <td>A number that indicates the item number at which the search is to begin. If this argument is not specified, searching begins at the last item in the <var>stringlist</var>.</td></tr>
| |
| <tr><th>startcol</th>
| |
| <td>A number that specifies the starting column of the range of columns within which the specified string is searched for. This is an optional argument, and it defaults to 1.</td></tr>
| |
| <tr><th>endcol</th>
| |
| <td>A number that specifies the ending column of the range of columns within which the specified string is searched for. This is an optional argument, and it defaults to 6124. If <var class="term">caseflag</var> is a non-zero integer, the width of the searched column range is reduced to a maximum of 256.</td></tr>
| |
| <tr><th>caseflag</th>
| |
| <td>An indicator for case-insensitive comparisons. If this argument is a non-zero integer, the string comparisons use <var>stringlist</var> item data translated to uppercase (so the search string should be passed as an uppercase value). This is an optional argument, and it defaults to zero. If it is 1, the width of the searched column range is reduced to a maximum of 256.</td></tr>
| |
| </table>
| |
| | |
| ==Usage notes==
| |
| <ul>
| |
| <li><var>LocateUp</var> returns a 0 if the indicated string is not found, and it cancels the request for all other errors.<li>While, under <var class="product">Sirius Mods</var> Version 6.6 and later, <var>stringlist</var> items can be longer than 6124 bytes long, the <var>LocateUp</var> method will only look for matches in the first 6124 bytes of any <var>Stringlist</var> item.</ul>
| |
| | |
| ==Examples==
| |
| The following code locates a string anywhere in a a <var>stringlist</var> %list item, searching backwards starting at item 100.<pre>
| |
| %num = %list:locateUp('Vietnamerica', 100)
| |
| </pre>
| |
| | |
| [[Category:Stringlist methods|LocateUp function]]
| |