Click or drag to resize

AScanExact Function (Array, Usual, Usual, Usual)

Scan an array until there is an exact match or a code block returns TRUE.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.10
Syntax
 FUNCTION AScanExact(
	aTarget AS ARRAY,
	uSearch AS USUAL,
	nStart AS USUAL := NIL,
	nCount AS USUAL := NIL
) AS DWORD
View Source

Parameters

aTarget
Type: Array
The array to scan.
uSearch
Type: Usual
The value to scan for.  Unless this argument is a code block, it must match the data type of the elements in <aTarget>.
nStart (Optional)
Type: Usual
The starting element.  A negative value starts from the end.  If <nCount> is positive, the default value is 1; if <nCount> is negative, the default value is the length of the array.
nCount (Optional)
Type: Usual
The number of elements to process from <nStart>.  A negative value starts from the end.  The default is all elements to the end of the array.

Return Value

Type: UInt32
If <uSearch> is a code block, AScanExact() returns the position of the element if the code block returned TRUE.  Otherwise, AScanExact() returns the position of the first exact-matching element.  AScanExact() returns 0 if no exact match is found.
Remarks
AScanExact() is the same as AScan() except that == is used for matching instead of =.  See the "Operators and Expressions" chapter in the Programmer's Guide for more information on how these operators work.
Examples
This example shows the difference between AScanExact() and AScan():
X#
aArray := {"Larger", "Large"}
? "Larger" = "Large"                        // TRUE
? "Larger" == "Large"                        // FALSE
? AScan(aArray, "Large")                        // 1
? AScanExact(aArray, "Large")                // 2
See Also