Reputation: 4122
I the following .replace
statement I have an issue in that I am trying to replace a consecutive single and double quotation in a string:
mystring.replace(''"', '"')
That doesn't seem to work though, I suspect because I am wrapping the string to be replaced also in single quotes. How can I get around this?
Upvotes: 2
Views: 656
Reputation: 5629
The second '
will be considered to be the closing quote, escape it using a \
to consider it in.
replace
mystring.replace(''"', '"')
with
mystring.replace('\'"', '"');
Upvotes: 2