ASP uses the Filter function to retrieve the array implementation code

Source: Internet
Author: User

Syntax description:

Filter Function
Returns an array with a subscript starting from zero, which contains a subset of a string array based on a specific filter condition.
Filter (InputStrings, Value [, Include [, Compare])
Parameters
InputStrings
Required. A one-dimensional array in which a string is to be searched.
Value
Required. The string to be searched.
Include
Optional. Boolean Value, which specifies whether the returned substring contains Value. If Include is True, Filter returns an array subset that contains the sub-string Value. If Include is False, the Filter returns an array subset that does not contain the sub-string Value.
Compare
Optional. Numeric value indicates the comparative string type. See value setting.
Set
The Compare parameter can have the following values:
Constant
Value
Description
VbBinaryCompare
0
Perform binary comparison.
VbTextCompare
1
Execute text comparison.
Description
If no Value matches the Value in InputStrings, the Filter returns an empty array. If InputStrings is Null or not a one-dimensional array, an error occurs.
The array returned by the Filter function only contains elements that are sufficient to contain the number of matching items.

The following example uses the Filter function to return an array containing the Search Condition "Mon:Copy codeThe Code is as follows: Dim MyIndex
Dim MyArray (3)
MyArray (0) = "Sunday"
MyArray (1) = "Monday"
MyArray (2) = "Tuesday"
MyIndex = Filter (MyArray, "Mon") 'myindex (0) contains "Monday ".

Note that MyIndex is an array !~Copy codeThe Code is as follows: Dim MyIndex, IndexItem
Dim MyArray (2)
MyArray (0) = "Sunday"
MyArray (1) = "Monday"
MyArray (2) = "Monday"
MyIndex = Filter (MyArray, "Tuesday ")
For IndexItem = 0 To UBound (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.