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

Left Of Last Match Function
String Searches Class

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

Return the portion of vLine before the last occurrence of vFind, else return vIfNotFound.
If a match is found, it does not include the matching text in the string that is returned.

Examples:
    LeftOfLastMatch("This is a test.", "is") = "This "
    LeftOfLastMatch("This is a test.", "sample") = "This is a test."
    LeftOfLastMatch("This is a test.", "sample", Null, "Not found.") = "Not found."
    LeftOfLastMatch("This is a test.", "") = "This is a test."
See also:
    LeftOfLastMatchFast function
    LeftOfFirstMatch Function
    RightOfLastMatch Function
vLine: The string which is to be searched for the appearance of string vFind. Function returns Null if vLine is Null or cannot be fixed up to a String.

vFind: The string which is to be searched for within string vLine. Function returns Null if vFind is Null or cannot be fixed up to a String.

Function returns vLine if vFind is an empty 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.

vIfNotFound: The string which is to be returned if vFind does not appear within vLine. vIfNotFound defaults to vLine (i.e. the string is returned unchanged) if it is missing or Null or cannot be fixed up to a String.

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