Name

Filter Function — Microsoft.VisualBasic.Strings

Synopsis

Filter(Source, Match[, Include[, Compare]])
Source required; String or Object

An array containing values to be filtered.

Match required; String

The substring of characters to find in the elements of the source array.

Include optional; Boolean

A Boolean (True or False) value. If True (the default value), Filter includes all matching values in the returned array; if False, Filter excludes all matching values (or, to put it another way, includes all nonmatching values).

Compare optional; CompareMethod enumeration

A constant whose value can be CompareMethod.Text or CompareMethod.Binary (the default).

Return Value

A 0-based String array of the elements filtered from Source

Description

The Filter function produces an array of matching values from an array of source values that either match or do not match a given filter string. Put another way, individual elements are copied from a source array to a target array if they either match (Include is True) or do not match (Include is False) a filter string.A match occurs for an array element if Match is a substring of the array element.

Get VB.NET Language Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.