strUnQuote

This will tests to see if strQuotedString is wrapped in quotation marks, and, if so, remove them.
Edit: 2024-01-06: Adding ability to remove single or double quotes, 2nd parameter.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function strUnQuote(ByVal strQuotedString, Optional QuoteCharAscii = 34)
    ' This will tests to see if strQuotedString is wrapped in quotation marks, and, if so, remove them.
    gstrQUOTE = Chr(QuoteCharAscii) ' Chr(34) ' 34 is ", while 39 is '
    strQuotedString = Trim(strQuotedString)
    If Mid$(strQuotedString, 1, 1) = gstrQUOTE And Right$(strQuotedString, 1) = gstrQUOTE Then
        ' It's quoted. Get rid of the quotes.
        strQuotedString = Mid$(strQuotedString, 2, Len(strQuotedString) - 2)
    End If
    strUnQuote = strQuotedString
End Function

ByVal strQuotedString, Optional QuoteCharAscii = 34

Views 4,173

Downloads 1,405

CodeID
DB ID