Navigation: thinBasic Modules > Core > Array functions > ARRAY SCAN |
|
Description
Scan all or part of an array searching for a given value.
Syntax
nRec = ARRAY SCAN ArrayVariable([StartIndex]) [FOR nElements] [, COLLATE UCASE], Expression
Returns
Numeric
Item element where the scan operation found the requested value.
ATTENTION: returned value is relative to StartIndex if StartIndex is specified otherwise will be absolute position starting from 1.
Zero means no items found
Parameters
Name |
Type |
Optional |
Meaning |
ArrayVariable |
Array |
No |
Name of a declared and already dimensioned array. |
StartIndex |
Number |
Yes |
The element index inside the array from which to start to SCAN. If omitted, 1 is assumed |
nElements |
Number |
Yes |
If present, it indicates the number of consecutive elements to be scanned (starting from StartIndex). |
Expression |
No |
Expression consist of logical relation operator (=, <>, >, >=, <, <=) followed by an expression of the same data type of ArrayVariable. Examples: = "AnyString expression" & MID$("ABC", 2, 1) >= 234 <1000
|
Remarks
If considering StartIndex and nElements, scanning will be outside array bounds, in any case SCAN will go till the end of the array.
Restrictions
Only dynamic string and numeric arrays are permitted here.
COLLATE UCASE is valid only for dynamic string arrays. COLLATE UCASE is used to consider all elements inside array as uppercase.
See also
Examples
© 2004-2008 thinBasic. All rights reserved. | Version 1.7.0.0 | Web Site: http://www.thinbasic.com |