AScanBinExact Function | |
Scan a sorted array until there is an exact match or a code block returns 0.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION AScanBinExact(
aTarget AS ARRAY,
uSearch AS USUAL
) AS DWORD
public static uint AScanBinExact(
Array aTarget,
Usual uSearch
)
Request Example
View SourceParameters
- aTarget
- Type: Array
The sorted 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.
If uSearch is a code block, it should return a numeric value that indicates the outcome of the comparison: a positive value indicates that uSearch is greater than the current array element, a 0 stands for equality, and a negative value indicates that uSearch is less than the current array element.
Return Value
Type:
DWord
If
uSearch is a code block, AScanBinExact() returns the position of the element if the code block returned 0.
Otherwise, AScanBinExact() returns the position of an exact-matching element.
If multiple occurrences of the same element exist, the returned exact match is not necessarily the lowest numbered element since AScanBinExact() uses a binary search algorithm.
AScanBinExact() returns 0 if no exact match is found.
Remarks
AScanBinExact() is the same as AScanBin() except that == is used for matching instead of =.
Examples
This example shows the difference between AScanBinExact() and AScanBin():
1aArray := {"Larger", "Largest"}
2? "Larger" = "Large"
3? "Larger" == "Large"
4? AScanBin(aArray, "Large")
5? AScanBinExact(aArray, "Large")
See Also