$Lstr Index: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
(Automatically generated page update)
Line 50: Line 50:
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>Japanese functions</li>
<li>Japanese functions</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>


</ul>
</ul>
   
   
[[Category:$Functions|$Lstr_Index]]
[[Category:$Functions|$Lstr_Index]]

Revision as of 23:09, 19 February 2015

Find a string inside a longstring

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_Index function are PositionOf and PositionIn.

This function takes two longstring inputs and produces the position of one input inside the other.

The $Lstr_Index function accepts three arguments and returns a numeric result.

The first argument is an arbitrary longstring. This is a required argument.

The second argument is a longstring whose length, ironically, must be 255 bytes or less. This is a required argument.

The third argument is a number indicating the position within the first string that a search for a match is to being. This is an optional argument and defaults to 1 meaning the first character.

Syntax

%result = $Lstr_Index(longstring, str, start)

%result is the position in longstring of str, if there is a match after start, or it is 0 if not.

Usage notes

  • $Lstr_Index acts very much like $INDEX except:
    • It allows a start position other than 1 (argument 3).
    • It cancels the request if the string being searched for (argument 2) is longer than 255 bytes.
    • It can operate on LONGSTRING inputs.

Examples

  1. To set %X to 6:

    %X = $Lstr_Index('Beauxbatons', 'bat')

  2. To set %X to 13:

    %X = $Lstr_Index('Dudley Dursley', 'ey', 8)

Products authorizing $Lstr_Index