Function String Searches Class

LineBeginsWith

Returns True if the string vLine begins with the string vFind.

Signature (Visual Basic / VBA)

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

Code Example

    LineBeginsWith("This is a test.", "This") = True
    LineBeginsWith("This is a test.", "is") = False
    LineBeginsWith("This is a test.", "") = True

Parameters

Parameter Description
vLine The string whose beginning is checked to see if it matches 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 at the beginning of string vLine. Function returns Null if vFind is Null or cannot be fixed up to a String.
vCompare Specifies the type of comparison used to determine if the strings match. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number.

Notes & Version History

Note Unlike most other string search functions, this one returns True if vFind is an empty string.