Function String Searches Class

IndicateMatches

Indicate which non-overlapping portions of one string match a specific string. Function includes the original string followed carriage return and line feed and then the string which indicates the matching portion using up-caret characters."

Signature (Visual Basic / VBA)

Public Function IndicateMatches( _
      ByVal vValue As Variant _
    , ByVal vFind As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    IndicateMatches(" 111 223 11111", "11") = " 111 223 11111" + vbCrLf + " ^^      ^^^^ "

Parameters

Parameter Description
vValue The string which is to be searched for non-overlapping occurrences of vValue. Function returns Null if vValue is Null or cannot be fixed up to a String.
vFind The string whose non-overlapping appearances within vValue are to be indicated. Function returns Null if vFind is Null or cannot be fixed up to a String. Empty strings are not considered to match anything, so if vFind is an empty string, then the indicator string will consist of spaces up to the length of string vValue.
vCompare Specifies the type of comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.