Function Comparisons Class

LikeAnyPattern

Return True if any of the LIKE patterns in string vPatterns match the string vSearch.

Signature (Visual Basic / VBA)

Public Function LikeAnyPattern( _
      ByVal vSearch As Variant _
    , ByVal vPatterns As Variant _
    , ByVal vCompare As Variant _
    , ByVal vPatternSep As Variant _
    ) As Variant

Code Example

    LikeAnyPattern("This is a test.", "* is *|* was *", vbBinaryCompare, "|") = True
    LikeAnyPattern("This is a test.", "* an *|* was *", vbTextCompare, "|") = False

Parameters

Parameter Description
vSearch The string which is compared with all of the patterns contained in string vPatterns. Function returns Null if vSearch is Null or cannot be fixed up to a String.
vPatterns The string containing one or more patterns (recognized by the Visual Basic LIKE operator) which are to be searched for within string vSearch. Multiple patterns are each separated by the pattern separator string vPatternSep. Function returns Null if vPatterns is Null or cannot be fixed up to a String.
vCompare Type of comparison uses when matching the patterns against the search string. Also, the type of comparisons used to locate the pattern separator strings vPatternSep within vPatterns. vCompare defaults to Binary comparisons if it is Null or cannot be fixed up to a number.
vPatternSep String which separates multiple patterns in the string vPatterns. Function returns Null if vPatternSep is Null or cannot be fixed up to a String.

Notes & Version History

Note This function only supports Binary comparisons and Text comparisons; it does not support the dbSort Constants.