IT. Expert System.

VBS

Filter()


Description

The Filter() function returns a zero-based array that contains a subset of a string array based on a filter criteria.

Note: If no matches of the value parameter are found, the Filter function will return an empty array.

Note: If the parameter inputstrings is Null or is NOT a one-dimensional array, an error will occur.

This function has the form:

Filter(inputstrings, value [,include [,compare]])
Parameter Description
inputstrings (required) A one-dimensional array of strings to be searched
value (required) The string to search for
include (optional) A Boolean value that indicates whether to return the substrings that include or exclude value. True returns the subset of the array that contains value as a substring. False returns the subset of the array that does not contain value as a substring.

(default = True)
compare (optional) Specifies the string comparison to use.

This parameter can have one of the following values:
  • 0 = vbBinaryCompare - Perform a binary comparison
  • 1 = vbTextCompare - Perform a textual comparison

Examples

Example 1

Filter: items that contains "S"

a = Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b = Filter(a,"S")

For Each x In b
  Msgbox(x)
Next

This produces the following result (each line in a separate pop-up message box):

Sunday
Saturday

Example 2

Filter: items that does NOT contain "S" (include=False):

a = Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b = Filter(a,"S",False)

For Each x In b
  Msgbox(x)
Next

This produces the following result (each line in a separate pop-up message box):

Monday
Tuesday
Wednesday
Thursday
Friday

Example 3

Filter: items that contains "S", with a textual comparison (compare=1):

a = Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
b = Filter(a,"S",True,1)

For Each x In b
  Msgbox(x)
Next

This produces the following result (each line in a separate pop-up message box):

Sunday
Tuesday
Wednesday
Thursday
Saturday

Miscellaneous Information

Supported in Version: 2.0


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 211 / 158679564. Delta: 0.00336 с