Name
Filter Function
Class
Microsoft.VisualBasic.Strings
Syntax
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 (
TrueorFalse) value. IfTrue(the default value), Filter includes all matching values in the returned array; ifFalse, Filter excludes all matching values (or, to put it another way, includes all nonmatching values).-
Compare(optional;CompareMethodenumeration) A constant whose value can be
CompareMethod.TextorCompareMethod.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.
Rules at a Glance
The default
Includevalue isTrue.The default
Comparevalue is CompareMethod.Binary.CompareMethod.Binaryis case sensitive; that is, Filter matches both character and case. In contrast,CompareMethod.Textis case insensitive, matching only character regardless of case.If no matches are found, Filter returns an empty ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access