$Windex: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(Automatically generated page update)
 
(34 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:$Windex}}
{{DISPLAYTITLE:$Windex}}
<span class="pageSubtitle"><section begin="desc" />Word number of first occurrence of word in phrase<section end="desc" /></span>
<span class="pageSubtitle">Word number of first occurrence of word in phrase</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. If you wish to replace <var>$Windex</var> with an OO funtion, use <var>[[WordPositionIn (String function)|WordPositionIn]]</var> (note that you should not replace the other way because like all OO methods, <var>WordPositionIn</var> is Longstring capable, while <var>$Windex</var> is not. Note that you may find the features of the [[StringTokenizer class|StringTokenizer]] to be even more helpful.</p>


This function finds the first occurrence of a word in a phrase.  
<span class="warning"><b>Note:</b></span> Many $functions have been deprecated in favor of Object Oriented methods. The recommended OO replacement function for <var>$Windex</var> is <var>[[WordNumberIn (String function)|WordNumberIn]]</var>. However, unlike <var>$Windex</var>, <var>WordNumberIn</var> is Longstring capable (like all OO methods), so '''do not''' replace <var>WordNumberIn</var> with <var>$Windex</var>. Note also that in some cases the [[StringTokenizer class|StringTokenizer]] may be a better OO solution.
                                 
 
<var>$Windex</var> finds the first occurrence of a word in a phrase.  


The $Windex function accepts three arguments and returns a numeric result that is the word number in the first argument string of the the second argument word.  
The $Windex function accepts three arguments and returns a numeric result that is the word number in the first argument string of the the second argument word.  
Line 15: Line 17:


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %NUM = $Windex(string, word, delim)
<p class="syntax"><span class="term">%NUM</span> = <span class="literal">$Windex</span>(<span class="term">string</span>, <span class="term">word</span>, [<span class="term">delim</span>])
<section end="syntax" /></p>
<p class="caption">$Windex Function
</p>
</p>
<p class="caption">%NUM is either a word number or 0.</p>
 
<p>
<var class="term">%NUM</var> is either a word number or 0.</p>
 
==Examples==
For example, this statement sets %JUNK to 3:
For example, this statement sets %JUNK to 3:
<p class="code"> %JUNK = $Windex('BOB CAROL TED ALICE', 'TED')
<p class="code">%JUNK = $Windex('BOB CAROL TED ALICE', 'TED')
</p>
</p>


This statement sets %JUNK to 0:
This statement sets %JUNK to 0:


<p class="code"> %JUNK = $Windex('BOB CAROL TED ALICE', 'ROGER')
<p class="code">%JUNK = $Windex('BOB CAROL TED ALICE', 'ROGER')
</p>
</p>


This statement sets %JUNK to 2:
This statement sets %JUNK to 2:


<p class="code"> %JUNK = $Windex('A WORD/OR TWO/BEFORE/I/GO', 'OR TWO', '/')
<p class="code">%JUNK = $Windex('A WORD/OR TWO/BEFORE/I/GO', 'OR TWO', '/')
</p>
</p>


==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>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
<p class="caption">Products authorizing $Windex
</p>


[[Category:$Functions|$Windex]]
[[Category:$Functions|$Windex]]

Latest revision as of 23:31, 20 September 2018

Word number of first occurrence of word in phrase


Note: Many $functions have been deprecated in favor of Object Oriented methods. The recommended OO replacement function for $Windex is WordNumberIn. However, unlike $Windex, WordNumberIn is Longstring capable (like all OO methods), so do not replace WordNumberIn with $Windex. Note also that in some cases the StringTokenizer may be a better OO solution.


$Windex finds the first occurrence of a word in a phrase.

The $Windex function accepts three arguments and returns a numeric result that is the word number in the first argument string of the the second argument word.

The first argument is an arbitrary string.

The second argument is word that is to be located in the first argument. If the second argument string is not found, $Windex returns a 0.

The third argument is a delimiter that separates words in the first argument string. This is an optional argument and defaults to blank.

Syntax

%NUM = $Windex(string, word, [delim])

%NUM is either a word number or 0.

Examples

For example, this statement sets %JUNK to 3:

%JUNK = $Windex('BOB CAROL TED ALICE', 'TED')

This statement sets %JUNK to 0:

%JUNK = $Windex('BOB CAROL TED ALICE', 'ROGER')

This statement sets %JUNK to 2:

%JUNK = $Windex('A WORD/OR TWO/BEFORE/I/GO', 'OR TWO', '/')

Products authorizing $Windex