ASP uses the filter function to retrieve the array implementation code _ Application Tips

Source: Internet
Author: User
Tags comparison
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.