Function String Searches Class

LeftOfLastMatchFast

Return the portion of vLine before the last occurrence of vFind, else return vIfNotFound. Faster version of the LeftOfLastMatch function which uses restrictive argument types to avoid argument fix-up code. If a match is found, it does not include the matching text in the string that is returned.

Signature (Visual Basic / VBA)

Public Function LeftOfLastMatchFast( _
      ByRef vIn As String _
    , ByRef vPat As String _
    , ByRef vCompare As VbCompareMethod _
    , ByRef vIfNotFound As String _
    ) As String

Code Example

    LeftOfLastMatchFast("This is a test.", "is", vbTextCompare, "") = "This "
    LeftOfLastMatchFast("This is a test.", "sample", vbTextCompare, "Not found.") = "Not found."

Parameters

Parameter Description
vCompare Specifies the type of comparison used to determine if strings match.
vIfNotFound The string which is to be returned if vFind does not appear within vLine.

Notes & Version History

vLine The string which is to be searched for the appearance of string vFind.
vFind The string which is to be searched for within string vLine. Function returns vLine if vFind is an empty string.