Function String Searches Class

CountTrailingStrings

Count the number of occurrences of one string (vFind) at the end of another (vLine).

Signature (Visual Basic / VBA)

Public Function CountTrailingStrings( _
      ByVal vLine As Variant _
    , ByVal vFind As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    CountTrailingStrings("AAA---AA", "A") = 2
    CountTrailingStrings("AAA---AA", "-") = 0

Parameters

Parameter Description
vLine The string whose ending portion is to be searched. Function returns Null if vLine is Null or cannot be fixed up to a String.
vFind The string whose number of non-overlapping occurrences at the end of vLine is to be counted. Function returns Null if vFind is Null or cannot be fixed up to a String. Function returns 0 (zero) if vFind is an empty string.
vCompare Specifies the type of comparison used to find matching strings. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.