I am trying to remove all the " from a string called s1, I have this line
s1=replace (s1, """, "")
But I get a compile error saying it is expecting a list separator or )
How can I fix it? Thanks in advance.
I am trying to remove all the " from a string called s1, I have this line
s1=replace (s1, """, "")
But I get a compile error saying it is expecting a list separator or )
How can I fix it? Thanks in advance.
Your second string isn’t properly delimited. If you want to use a quotation mark ("
) inside your string, you need to double it. Since your string only consists of a quotation mark, it looks as follows:
"
.""
."
.In summary:
s1 = Replace(s1, """", "")
Did you really write """
? You have to escape the "
in the middle - just double it like:
replace( s1, """", "" )
Konrad's suggestion is the one you should go with, but here's another for completeness/amusement.
s1 = Replace(s1, Chr(34), "")
And if you ever get bored at a party and need something to read on your phone, here's the list of the 256 such ASCII codes you can use with Chr().
http://msdn.microsoft.com/en-us/library/4z4t9ed1%28v=VS.80%29.aspx
Commonly used syntaxes are:
s1=replace (s1, "\"", "")
s1=replace (s1, """", "")
s1=replace (s1, '"', "")