I need to parse a string to remove and quotes so I can insert the string into my DB. I want to write a Public Function that I can just pass a string. How can I do this?
Public Function RemoveQuotes(ByRef strIn As String) As String
Dim i As Integer
Dim strPointer As String
Dim strOut As String
For i = 1 To Len(strIn)
strPointer = Mid(strIn, i, 1)
If strPointer = Chr$(34) Or strPointer = Chr$(39) Then
Else
strOut = strOut & strPointer
End If
Next i
RemoveQuotes = strOut
End Function
Craig, mailto:sander@cogeco.ca
"Procrastination is the art of keeping up with yesterday."
I hope my post was helpful!!!
And here (ineveitably) is the Regular Expressions version. You'll need to add a reference to the Microsoft VBScript Regular Expressions, then: [tt]
Option Explicit
Public Function NoQuotes(strSource As String) As String
Dim re As RegExp
Set re = New RegExp
re.Global = True
re.Pattern = """|'"
NoQuotes = re.Replace(strSource, ""
End Function
Nice Sample CodeFish... =D Craig, mailto:sander@cogeco.ca
"Procrastination is the art of keeping up with yesterday."
I hope my post was helpful!!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.