Function String Manipulations Class

QuoteString

Surrounds a string with some "quote" character. Replaces each "quote" character within the string with two "quote" characters.

Signature (Visual Basic / VBA)

Public Function QuoteString( _
      ByVal vValue As Variant _
    , Optional ByVal vQuoteChar As Variant _
    ) As Variant

Code Example

    QuoteString("Joseph 'Joe' Marks", "'") = "'Joseph ''Joe'' Marks'"
    QuoteString("12345", "'") = "'12345'"

Parameters

Parameter Description
vValue The string which is to be quoted. Function returns Null if vValue is Null or cannot be fixed up to a String.
vQuoteChar The character (or string) which is to be used to quote the string vValue. vQuoteChar defaults to an empty string if it is missing or Null or cannot be fixed up to a String. i.e. vValue will be returned in string form but with no quote characters added.