Click or drag to resize

AScanExact Function (Array, Usual)

X#
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.19
Syntax
 FUNCTION AScanExact(
	aTarget AS ARRAY,
	uSearch AS USUAL
) AS DWORD
Request Example 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.

Return Value

Type: DWord
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 =.
Examples
This example shows the difference between AScanExact() and AScan():
X#
1aArray := {"Larger", "Large"}
2? "Larger" = "Large"            // TRUE
3? "Larger" == "Large"            // FALSE
4? AScan(aArray, "Large")            // 1
5? AScanExact(aArray, "Large")        // 2
See Also