Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing Double Quotes

Status
Not open for further replies.

DugzDMan

Programmer
Oct 19, 2000
157
US
Does anyone know who I can remove all the double quotes in a string?

I know this is easy and I've done it some time ago (though not with the double quotes), but I can't find that project.

Thanks!
 
Use the replace function

Replace(string, """", "")


Rob
 
I was thinking about that, but doesn't it return the number of times the string would be replaced?

Thanks!
 
No, actually it returns the new string, so it really should look like this:

newstring = Replace(string, """", "")


Rob
 
OK, I've come up with this (just a quick blurb to get me out for the day), but I'd imagine there's a better way to do it.

Code:
Do Until InStr(1, strTempString, """") = 0
   If InStr(1, strTempString, """") = 1 Then
       strTempString = Right(strTempString, Len(strTempString) - 1)
   Else
       lQuotePos = InStr(1, strTempString, """")
       strTempString = Mid(strTempString, 1, lQuotePos - 1) & _
           Mid(strTempString, lQuotePos + 1, Len(strTempString) - lQuotePos)
   End If
Loop
[\code]
 
Ah, I gotcha!

Thanks, that will work much better!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top