Function String Searches Class

GetPossiblyQuotedField

Remove the first (possibly quoted) value from a string and return that value. Similar to the GetToken functions, except that token can appear within quotes.

Signature (Visual Basic / VBA)

Public Function GetPossiblyQuotedField( _
      ByRef rLine As Variant _
    , Optional ByVal vQuoteString As Variant _
    , Optional ByVal vFieldSeparator As Variant _
    , Optional ByVal vCompare As Variant _
    ) As Variant

Code Example

    Assuming
       Dim S As String
       S = "'First field','Second Field',45.67"
    for example
       GetPossiblyQuotedField(S, "'", ",") = "First Field"
    leaves
       S = "'Second Field',45.67"

Parameters

Parameter Description
rLine The line containing the fields of which the first is to be removed and returned. Function returns Null if rLine is Null or cannot be fixed up to a String. Function returns an empty string if rLine is an empty string.
vQuoteString The string which may possibly quote string-type fields. vQuoteString defaults to the double quote character if it is missing or Null or cannot be fixed up to a String.
vFieldSeparator The string which separates fields within string rLine. vFieldSeparator defaults to the comma character if it is missing or Null or cannot be fixed up to a String. If the field separator is an empty string, then the string rLine is considered to consist of a single field.
vCompare Specifies the type of comparison used to determine if the quote and field separator strings match portions of string rLine. vCompare defaults to Binary comparisons if it is missing or Null or cannot be fixed up to a number. If the first field is not quoted and is numeric, then its value is returned as a Double. If the first field is not quoted and it is a value date, then it is returned as a Date. Any other non-quoted values are returned as strings.