Array.IndexOfValue

Top  Previous  Next

Returns the array index of the given value.

 

Syntax

function Array.IndexOfValue(AArray: array; ASearchValue: variant): integer

 

Alternative Names

ibec_IndexOfValue

 

Description

Searches the array for the given value and then returns the index in the array. If the value cannot be found this returns -1.

 

AArray holds a previously created array of any length.

 

ASearchValue is the value to look up in the array.

 

The Return Value is the index in the array or -1 if the value cannot be found.

 

Example

execute UDSBlock returns (index_value integer)

as

begin
  /* create an array with 3 elements */

  array_value = Array.Create('zero', 'one', 'two');

  index_value = Array.IndexOfValue(array_value, 'two');

  suspend; /* returns 2  */

  

  index_value = Array.IndexOfValue(array_value, 'not available');

  suspend; /* returns -1 */

end