$Windex: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Word number of first occurrence of word in phrase<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Word number of first occurrence of word in phrase<section end="desc" /></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>
<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)|WordNumberIn]]</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.  
This function finds the first occurrence of a word in a phrase.  

Revision as of 19:57, 27 April 2011

<section begin="desc" />Word number of first occurrence of word in phrase<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. If you wish to replace $Windex with an OO funtion, use WordNumberIn (note that you should not replace the other way because like all OO methods, WordPositionIn is Longstring capable, while $Windex is not. Note that you may find the features of the StringTokenizer to be even more helpful.

This function 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

<section begin="syntax" /> %NUM = $Windex(string, word, delim) <section end="syntax" />

$Windex Function

%NUM is either a word number or 0.

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