Function String Replacements Class

StripMatchingBeginLine

Strip vFind from vLine only if it appears at the beginning of vLine, otherwise return the string vLine unchanged.

Signature (Visual Basic / VBA)

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

Code Example

    StripMatchingBeginLine("This is a test.", "This") = " is a test."
    StripMatchingBeginLine("This is a test.", " is ") = "This is a test.
    StripMatchingBeginLine("This is a test.", "") = "This is a test.

Parameters

Parameter Description
vLine The string whose beginning is to be removed if it matches string vFind. Function returns Null if vLine is Null or cannot be fixed up to a String (Behavior #1).
vFind The string which is to be removed from the beginning of vLine if present. Function returns Null if vFind is Null or cannot be fixed up to a String (Behavior #2). Function returns vLine unchanged if vFind is an empty string (Behavior #3).
vCompare Specifies the type of comparison used to determine if the strings match (Behavior #4). vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number (Behavior #5).