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.
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
' 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,147
Downloads 1,391
CodeID
DB ID
ANmarAmdeen
610
Revisions
v2.0
Saturday
January
6
2024