Tuesday, August 10, 2010

Visual Basic String Function : Filter

Purpose : The Filter function searches through a given string array for a specified filter criterion and returns the value to a zero-bases array.

Syntax :
Filter(InputStr , FindValue [ , Include [ , Compare ] ] )

InputStr : A One-dimensional array that the function searches through
FindValue : A string value being searched for
Include : A Boolean argument that indicates whether to rerurn string that include or exclude FindValue string
Compare : A numeric value indicating the kind of comparison to use when evaluating FindValue against the inputStr array. by default value is vbBinaryCompare
0 : vbBinaryCompare
1 : vbTextCompare

Dim vIdx as Variant
Dim vArray(3)
Dim x as Integer
vArray(0) = "Forthy"
vArray(1) = "Forthy Two"
vArray(2) = "Four Hundred"
vArray(3) = Fantastic Four"
vIdx = Filter(vArray , "For")
For x = 0 To UBound(vIdx, 1 )
Debug.Print vIdx ( x )
Next

No comments:

Post a Comment