Filter

Public Function Filter(ByVal InputArray As Array(), ByVal Find As String, Optional ByVal Include As Boolean = True, Optional ByVal CompareMode As Long = 0, Optional ByVal UsePatternMatching As Boolean = False) As String()

Filters an array of strings for a specific value or pattern and returns an array of strings with the (non)matching items.

Dim lArray As String() = {"This", "is", "a", "demo"}
Dim lNewArray As String = Filter(lArray, "*i*", True, vbBinaryCompare, True) 'lNewArray now is {"This", "is"}
Dim lRestArray As String = Filter(lArray, "*i*", False, vbBinaryCompare, True) 'lRestArray now is {"a", "demo"}

See also: