Link to home
Start Free TrialLog in
Avatar of jweissdandm
jweissdandm

asked on

how to remove double quote from string

Hopefully a simple solution.  I am trying to pass text to a variable...

myText...

This is a "lovely day" for all of us experts.

I want to assign the text above to a variable (strData) and I want to strip out the double quotes.  I am getting that text from my CMS application.
I have been using this without any luck
 
function cleanString(myString)
    myString = replace(myString,"'","")
    myString = replace(myString,"","")   
    myString = replace(mystring,"", "")
    myString = replace(mystring,"", "")
   ' myString = Replace(mystring, """, "")
    mySring  = Replace(mystring, "'", "")
    myString = replace(mystring, """","")
    'myString = replace(mystring,"chr(34)","")
    'myString = replace(mystring, chr(34),"")
 
    cleanString = myString
end function

Open in new window

Avatar of ThinkPaper
ThinkPaper
Flag of United States of America image

Hmm.. This should have resolved the problem:

myString = replace(mystring, """","")

I wonder if it's an issue with it going thru the function properly. What happens when you run the replace directly on the string itself, then print it out to see?

mystring = 'This word is "quoted" yo.'
mystring = replace(mystring, """","")
response.write mystring

If it still fails, do a replace for another character just to ensure it is working properly (say, the character 'o').
ASKER CERTIFIED SOLUTION
Avatar of Robin Uijt
Robin Uijt
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial