Function String Searches Class

InStrReverseFast

"In String Reverse (Fast)" Find the last occurrence of one string within another. Faster version of the InStrReverse function which uses restrictive argument types to avoid argument fix-up code.

Signature (Visual Basic / VBA)

Public Function InStrReverseFast( _
      ByRef vStartPos As Long _
    , ByRef vLine As String _
    , ByRef vFind As String _
    , ByRef vCompare As VbCompareMethod _
    ) As Long

Code Example

    InStrReverseFast(15, "THIS IS A TEST.", "IS", vbBinaryCompare) = 6
    InStrReverseFast(10, "THIS IS A TEST.", "TEST", vbBinaryCompare) = 0

Parameters

Parameter Description
vStartPos The character position in string vLine where the search is to begin.
vLine The string which is to be searched from right-to-left for the appearance of string vFind.
vFind The string which is to be searched for within string vLine.
vCompare Specifies the type of comparison used to determine if the strings match. Function returns 0 (zero) if string vFind does not appear anywhere within string vLine.

Notes & Version History

v1.5 Note This function is similar to the new InStrRev function in Visual Basic 6.0, except that the arguments are arranged differently.