Searches an array for an expression. Returns the number of the first element that matches the expression if the search is successful, or 0 if the search is unsuccessful.

Syntax

<oRef>.scan(<exp> [, <starting element expN> [, <elements expN>]])

<oRef>

A reference to the array you want to search.

<exp>

The expression you want to search for in <oRef>.

<starting element expN>

The element number in <oRef> at which you want to start searching. Without <starting element expN>, scan( ) starts searching at the first element.

<elements expN>

The number of elements in <oRef> that scan( ) searches. Without <elements expN>, scan( ) searches <oRef> from <starting element expN> to the end of the array. If you want to specify a value for <elements expN>, you must also specify a value for <starting element expN>.

Property of

Array

Description

Use scan( ) to search an array for the value of <exp>. For example, if an array contains customer names, you can use scan( ) to find the location in which a particular name appears.

scan( ) returns the element number of the first element in the array that matches <exp>. If you want to determine the subscripts of this element, use subscript( ).

When <exp> is a string, scan( ) is case-sensitive; you may want to use UPPER( ), LOWER( ), or PROPER( ) to match the case of <exp> with the case of the data stored in the array. scan( ) also follows the rules established by SET EXACT to determine if <exp> and the array element are equal. For more information, see SET EXACT.