Function String Searches Class

FirstMatchingPosition

Returns the position of the first matching characters in corresponding positions of the two strings.

Signature (Visual Basic / VBA)

Public Function FirstMatchingPosition( _
      ByVal vOne As Variant _
    , ByVal vTwo As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    FirstMatchingPosition("AAABBBCCC", "CBAABCCBA") = 3
    FirstMatchingPosition("AAABBBCCC", "BBBCCC") = 0

Parameters

Parameter Description
vOne One of the two strings from which characters in corresponding positions will be compared for a match. Function returns Null if vOne is Null or cannot be fixed up to a String.
vTwo One of the two strings from which characters in corresponding positions will be compared for a match. Function returns Null if vTwo is Null or cannot be fixed up to a String.
vCompare Specifies the type of comparison used to determine if corresponding characters match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number. Function returns 0 (zero) if no corresponding characters match.