Function Comparisons Class

LikePattern

Return True if any of the LIKE pattern in string vPattern matches the string vSearch.

Signature (Visual Basic / VBA)

Public Function LikePattern( _
      ByVal vSearch As Variant _
    , ByVal vPattern As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    LikePattern("This is a test.", "* IS *", vbTextCompare) = True
    LikePattern("This is a test.", "* IS *", vbBinaryCompare) = False

Parameters

Parameter Description
vSearch The string which is checked to see if it matches the pattern in string vPattern. Function returns Null if vSearch is Null or cannot be fixed up to a String.
vCompare Type of comparison uses when matching the pattern against the search string. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

vPatterns String containing a pattern (as recognized by the Visual Basic LIKE operator) which is checked to see if it matches the string vSearch. Function returns Null if vPattern is Null or cannot be fixed up to a String.
Note This function only supports Binary comparisons and Text comparisons; it does not support the dbSort Constants.