ASCAN()
Scan array elements for a specified condition
Syntax
ASCAN( <aTarget>, <xSearch>, [<nStart>], [<nCount>] ) --> nStoppedAt
Arguments
<aTarget> Array to be scanned.
<xSearch> Expression to search for in <aTarget>
<nStart> Beginning subscript position at which to start the search.
<nCount> Number of elements to scan with <aTarget>.
Returns
<nStoppedAt> A numeric value of subscript position where <xSearch> was found, or 0 if <xSearch> is not found.
Description
This function scan the content of array named <aTarget> for the value of <xSearch>. The return value is the position in the array <aTarget> in which <xSearch> was found. If it was not found, the return value will be 0.
If specified, the beginning subscript position at which to start scanning may be set with the value passed as <nStart>. The default is 1.
If specified, the number of array elements to scan may be set with the value passed as <nCount>. The default is the number of elements in the array <aTarget>.
If <xSearch> is a code block, the operation of the function is slightly different. Each array subscript pointer reference is passed to the code block to be evaluated. The scanning routine will continue until the value obtained from the code block is a logical true (.T.) or until the end of the array has been reached.
Examples
LOCAL aDir := Directory( "*.prg" ) AScan( aDir,,, {| x, y | x[ 1 ] := "test.prg" } )
Compliance
This function is not CA-Cl*pper compatible. CA-Cl*pper ASCAN() is affected by the SET EXACT ON/OFF Condition
Files
Library is vm
Seealso
AEVAL()
Pingback: Harbour All Functions — A | Viva Clipper !
Pingback: Harbour Array Functions | Viva Clipper !
Pingback: Harbour RG Summary | Viva Clipper !