AScan( )

Action: Searches an array for an element containing the same value as an expression.
 
Syntax: AScan (array, expression, start, length, flags)
 
Parameters: Array

Name of the array to search.

Expression

Specifies the expression to search for.

Start

Optional argument specifying the element number at which the search begins. The element number you specify is included in the search.

Length

Optional value specifying the number of elements to scan. If you omit this value, the search continues to the last array element.

Flags

Optional value combining one or more flags. Possible values:

Flag (bit) Value Action
0 0 Search for exact match (default)
  1 Search for an element containing the search string
1 0 Return first matching element (default)
  1 Return all matching elements


 

Returns:
0 ID of the element that matches the expression.
-1 Expression not present in array.
 
See Also: Dim, Join( ), Split( ), UBound( )
 
Example:

$Array = 1,2,3,5,7,11,13
$x = ASCAN($Array, 3) ; will return '2'

$Array = 'SomeString', 'AnotherString', 'LastString'
$x = ASCAN($Array, 'other', , , 1) ; will return '1'

AScan( $Array, $String,,, 0) ; scan for exact match and return 1st hit
 
AScan( $Array, $String,,, 1) ; use InStr() and return 1st hit
 
AScan( $Array, $String,,, 2) ; scan for exact match and return all hits
 
AScan( $Array, $String,,, 3) ; use InStr() and return all hits