VBS TUTORIAL: function-filter function _vbs

Source: Internet
Author: User

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 returns a subset of the array that contains the substring Value . 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:

Constants value Description
Vbbinarycompare 0 Performs a binary comparison.
vbTextCompare 1 Performs a text comparison.

Description

If no value is found in inputstrings , theFilter 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":

  Dim Myindexdim myarray (3) myarray (0) = "Sunday" myarray (1) = "Monday" myarray (2) = "Tuesday" Myindex =   Filter ( myarray ,  "Mon"  )  ' myindex (0)   The   contains  Monday . 

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.