$Lstr Windex: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Automatically generated page update)
Line 17: Line 17:
<p class="syntax"><span class="term">%result</span> = $Lstr_Windex(longstring, word, delims)
<p class="syntax"><span class="term">%result</span> = $Lstr_Windex(longstring, word, delims)
</p>
</p>
<p class="caption">$Lstr_Windex function
 
</p>
<p>%result is the position of '''word''' within '''longstring'''.</p>
<p>%result is the position of '''word''' within '''longstring'''.</p>


For example
==Examples==
<p class="code"> %RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea')
<ol>
<li>To set %RES to "6":
<p class="code">%RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea')
</p>
</p>


sets %RES to "6" and
<li>To set %RES to "3":


<p class="code"> %RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea', '- ')
<p class="code">%RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea', '- ')
</p>
</p>
 
</ol>
sets %RES to "3".
 
<var>$Lstr_Windex</var> is only available in <var class="product">[[Sirius Mods]]</var> Version 6.5 and later.


==See also==
==See also==

Revision as of 01:19, 19 July 2013

Return the position of a word within a long string

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Lstr_Windex is WordNumberIn. Or, you may find the features of the StringTokenizer to be more helpful.

This function takes a string or longstring input and returns a number indicating the word position of the second argument within the long string. If the word is not present, zero is returned.

The $Lstr_Windex function accepts three arguments and returns a string result.

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

The second argument is an arbitrary string containing a single word. The word must have no occurrences of any of the delimiters in argument three, and may not be null. This is a required argument.

The third argument is a string containing from 1 to 255 characters which are the delimiters for the longstring. This is an optional argument and defaults to a blank.

Syntax

%result = $Lstr_Windex(longstring, word, delims)

%result is the position of word within longstring.

Examples

  1. To set %RES to "6":

    %RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea')

  2. To set %RES to "3":

    %RES = $Lstr_Windex('She sells sea-shells by the sea shore', 'sea', '- ')

See also

Products authorizing $Lstr_Windex