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

Left Of First Match Function
String Searches Class

Public Function LeftOfFirstMatch( _
      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 first 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:
    LeftOfFirstMatch("This is a test.", "is") = "Th"
    LeftOfFirstMatch("This is a test.", "sample") = "This is a test."
    LeftOfFirstMatch("This is a test.", "sample", Null, "Not found.") = "Not found."
    LeftOfFirstMatch("This is a test.", "") = ""
See also:
    LeftOfFirstMatchFast function
    LeftOfLastMatch Function
    RightOfFirstMatch Function
vLine: The string which is to be searched from left-to-right 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 an empty string 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.