$Arr_Find

From m204wiki
Revision as of 17:35, 28 January 2011 by 198.242.244.47 (talk) (Created page with "{{DISPLAYTITLE:$Arr_Find}} <span class="pageSubtitle"><section begin="desc" />Find value within array<section end="desc" /></span> <p class="warning">Most Sirius $functions have...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<section begin="desc" />Find value within array<section end="desc" />

Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Arr_Find function is to be entered.

$Arr_Find can be used to find an array element with a specific value. $Arr_Find accepts three arguments and returns a numeric code.

The first argument is an array of string, float, or fixed values. This array must be a single dimensional array and must not be an array in an image.

The second argument is the value to be located in the array. If this value is found in multiple array elements, $Arr_Find always returns the first (lowest element number) array element containing this value.

The third argument is the lowest array element number to check. This argument can be used to skip the first "N" array elements where N is a positive integer.

Syntax

<section begin="syntax" /> %RESULT = $Arr_Find (array, value, minnum) <section end="syntax" />

$Arr_Find Function

%RESULT is set to the array element number containing the indicated value, or it is set to a -1 if the value was not found or if the array or minnum is invalid.


In the following example

%FXARRAY IS FIXED ARRAY(5) %FXARRAY(1) = 2 %FXARRAY(2) = 3 %FXARRAY(3) = 5 %FXARRAY(4) = 8 %NUM = $Arr_Find(%FXARRAY,5)

%NUM is set to 3.

In the following example

%STARRAY IS STRING LEN 20 ARRAY(6) %STARRAY(1) = 'ONE' %STARRAY(2) = 'TWO' %STARRAY(3) = 'THREE' %STARRAY(4) = 'FOUR' %STARRAY(5) = 'ONE' %STARRAY(6) = 'TWO' %NUM = $Arr_Find(%STARRAY, 'ONE', 2)

%NUM is set to 5.

Products authorizing $Arr_Find