Viva Clipper !

FT_ANOMATCHES

Advertisements
FT_ANOMATCHES()
 Find the number of array elements meeting a condition

 Syntax

      FT_ANOMATCHES( <aArray>, <bCompareBlock> ;
                     [, <nStartIndex> [, <nEndIndex> ] ] ) -> nNoOfMatches

 Arguments

     <aArray> is the array to be searched

     <bCompareBlock> is a code block containing the expression for
     the array elements to be tested with.  Each element is passed
     as a parameter to the block.  If the block returns .T., the
     number of matches will be incremented by one.

     <nStartIndex> is the first array item to include in the search,
     defaults to first element.

     <nEndIndex> is the last array element to include in the search,
     defaults to all elements.

 Returns

     The number of elements that cause the code block to return .T.

 Description

     This function returns the number of array elements that, when passed
     to the supplied code block, cause that code block to return a .T. value.

 Examples

     // Search the Entire Array
     FT_ANOMATCHES(aTries, { | x | x <= 100 } )

     // Search from the 5th Element On
     FT_ANOMATCHES(aCodes, { | x | UPPER(x) == cCurrentCode }, 5)

     // Search the 1st 10 Elements
     FT_ANOMATCHES(aDates, { | x | IS_BETWEEN(DATE()-7,x,DATE() + 7) }, 10)

     // Search Elements 5-10
     FT_ANOMATCHES(aNames, { | x | x <= cLastGoodName }, 5, 10)

 Source: ANOMATCH.PRG

 Author: David Husnian
Advertisements

Advertisements