Easy Tutorial
❮ Func Time Func Lcase ❯

VBScript Filter Function


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

Note: If no matching values are found for the value parameter, the Filter function returns an empty array.

Note: An error occurs if the inputstrings parameter is Null or is not a one-dimensional array.

Syntax

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 substrings that include or exclude Value. If Include is True, Filter returns the subset of the array that contains Value as a substring. If Include is False, Filter returns the subset of the array that does not contain Value as a substring. The default is True.
compare Optional. Specifies the type of string comparison to use. Possible values: 0 = vbBinaryCompare - Perform a binary comparison<br>1 = vbTextCompare - Perform a text comparison

Example 1

Filter: Items containing "S":

Example output:

Example 2

Filter: Items not containing "S" (include=False):

Example output:

Example 3

Filter: Items containing "S" using text comparison (compare=1):

Example output:


❮ Func Time Func Lcase ❯