Syntax Description:
Filter function
Returns a zero-based array containing a subset of a string array based on a specific filter condition.
Filter (Inputstrings, value[, include[, Compare])
Parameters
Inputstrings
Required option. A one-dimensional array in which to search for strings.
Value
Required option. The string to search for.
Include
Options available. Boolean value that specifies whether the returned substring contains Value. If include is True,filter, a subset of the array containing the substring Value is returned. If include is False,filter returns a subset of the array that does not contain the substring Value.
Compare
Options available. Numeric values indicate the type of comparison string used. See the Value Settings section.
Set up
The Compare parameter can have the following values:
Constant
Value
Describe
Vbbinarycompare
0
Performs a binary comparison.
vbTextCompare
1
Performs a text comparison.
Description
If no value is found in Inputstrings, the Filter returns an empty array. If Inputstrings is Null or is not a one-dimensional array, an error occurs.
The array returned by the Filter function contains only elements sufficient to contain the number of matches.
The following example uses the Filter function to return an array containing the search condition "Mon":
Copy Code code as follows:
Dim Myindex
Dim MyArray (3)
MyArray (0) = "Sunday"
MyArray (1) = "Monday"
MyArray (2) = "Tuesday"
Myindex = Filter (myarray, "Mon") ' Myindex (0) contains "Monday".
In the red position need to note that Myindex is an array! ~
Copy Code code as follows:
Dim Myindex,indexitem
Dim MyArray (2)
MyArray (0) = "Sunday"
M Yarray (1) = "Monday"
myarray (2) = "Monday"
Myindex = Filter (myarray, "Tuesday")
for indexitem = 0 to Ubou nd (myindex)
Response.Write Myindex (Monday) & "<br/>"
Next