Name
Filter Function
Class
Microsoft.VisualBasic.Strings
Syntax
Filter(Source, Match[, Include[, Compare]])-
Source Use: Required
Data Type: String or Object
An array containing values to be filtered.
-
Match Use: Required
Data Type: String
The substring of characters to find in the elements of the source array.
-
Include Use: Optional
Data Type: Boolean
A Boolean (
TrueorFalse) value. IfTrue(the default value),Filterincludes all matching values in the returned array; ifFalse,Filterexcludes all matching values (or, to put it another way, includes all nonmatching values).-
Compare Use: Optional
Type:
CompareMethodenumerationA 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 isCompareMethod.Binary.CompareMethod.Binaryis case sensitive; that is,Filtermatches both character and case. In contrast,CompareMethod.Textis case insensitive, matching only character regardless of case.If no matches ...
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