Sun Chili!Soft ASP Sun Chili!Soft
ASP Sun Microsystems

 

VBScript Filter Function

Returns a zero-based array containing subset of a string array based on a specified filter criteria.

Syntax: VBScript Filter Function

Filter(InputStrings, Value[, Include[, Compare]])

Arguments: VBScript Filter Function

InputStrings

A one-dimensional array of strings to be searched. Required.

Value

The string to search for. Required.

Include

A Boolean value indicating 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. Optional.

Compare

A numeric value indicating the kind of string comparison to use. See Settings section for values. Optional.

Settings: VBScript Filter Function

The Compare argument can have the following values:

Constant

Value

Description

vbBinaryCompare

0

Perform a binary comparison.

vbTextCompare

1

Perform a textual comparison.

Remarks: VBScript Filter Function

If no matches of Value are found within InputStrings, Filter returns an empty array. An error occurs if InputStrings is Null or is not a one-dimensional array. The array returned by the Filter function contains only enough elements to contain the number of matched items.

The following example uses the Filter function to return the array containing the search criteria "Mon":

Dim MyIndex

Dim MyArray (3)

MyArray(0) = "Sunday"

MyArray(1) = "Monday"

MyArray(2) = "Tuesday"

MyIndex = Filter(MyArray, "Mon") ' MyIndex(0) contains "Monday".

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Legal Notice.