<-- Previous || Up || Next -->

Strings Between Strings Function
String Searches Class

Public Function StringsBetweenStrings( _
      ByVal vSearch As Variant _
    , ByVal vLeft As Variant _
    , ByVal vRight As Variant _
    , Optional ByVal vSeparator As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Return the strings between all occurrences of vRight and vLeft.
If more than one match is found, the matches are separated by vSeparator.
Return a blank string if there is no match of vLeft followed by vRight.

Examples:
    StringsBetweenStrings("Forms![Menu]![Close]", "[", "]", "-") = "Menu-Close"
    StringsBetweenStrings("Forms![Menu]![Close]", "(", ")", "-") = "" ' #2.
    StringsBetweenStrings("Larry 'Bud' Melman", "'", "'", "-") = "Bud"
See also:
    StringsBetweenStringsFast Function
    StringBetweenStrings Function
vSearch: The string which is to be searched for non-overlapping appearances of vLeft followed by vRight. Function returns Null if vSearch is Null or cannot be fixed up to a String.

vLeft: The string which delimits the left side of each sub-string to be returned. Function returns Null if vLeft is Null or cannot be fixed up to a String.

vRight: The string which delimits the right side of each sub-string to be returned. Function returns Null if vRight is Null or cannot be fixed up to a String.

vSeparator: The string which will be used to separate the matching strings within the result. Function returns Null if vSeparator is Null or cannot be fixed up to a String.
vCompare: Specifies the type of comparison used to determine if strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Function returns an empty string if both vLeft or vRight is an empty string.

If vLeft is an empty string and vRight is not, the function returns the sub-string of vSearch between the beginning of the string and the first occurrence of vRight.

If vRight is an empty string and vLeft is not, the function returns the sub-string of vSearch between the first occurrence of vLeft and the end of the string.

Function returns an empty string if vLeft does not appear within vSearch followed by vRight.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.