Function String Searches Class

StringBetweenStringsFast

Return the string between the first occurrences of vRight and vLeft. Faster version of the StringBetweenStrings function which uses restrictive argument types to avoid argument fix-up code.

Signature (Visual Basic / VBA)

Public Function StringBetweenStringsFast( _
      ByRef vSearch As String _
    , ByRef vLeft As String _
    , ByRef vRight As String _
    , ByRef vCompare As VbCompareMethod _
    ) As String

Code Example

    StringBetweenStringsFast("Forms![Menu]![Close]", "[", "]", vbBinaryCompare) = "Menu"
    StringBetweenStringsFast("Forms![Menu]![Close]", "(", ")", vbBinaryCompare) = "" ' #2.
    StringBetweenStringsFast("Larry 'Bud' Melman", "'", "'", vbBinaryCompare) = "Bud"

Parameters

Parameter Description
vSearch The string which is to be searched for the appearance of vLeft followed by vRight.
vLeft The string which delimits the left side of the string to be returned.
vRight The string which delimits the right side of the string to be returned.
vCompare Specifies the type of comparison used to determine if strings match. Function returns an empty string if either vLeft or vRight is an empty string. Function returns an empty string if vLeft does not appear within vSearch followed by vRight as in example #2.