How to replace all double double(i.e. "") quotations with a single double quotation?

I am scraping a pdf using ABBYY OCR and I convert the output into a string. In certain places the string contains double double quotations (i.e. “”). For example the string contains: (““Us””, ““We””, ““You””). There are also other random occurrences of this issue.

I want to replace all occurrences of the double double quotes (“”) with a single double quote (").

So I use String.Replace("""","a") and this targets all double double quotes and replaces them with an ‘a’ character. But how can I replace them all with a double quotation character?

I am somewhat shocked that there is no escape character, e.g. the use of the back slash in c#, javascript etc.

Many thanks

Chris

How about using regular expression?
Like this.

replace_all_multiple_dquot.xaml (5.4 KB)

2 Likes

In VB.NET grammar, Two double-quotation in string literal means one double-quotation.

For example,

WriteLine("Hello ""World""")

writes.

Hello "World"
1 Like

Hi Honoka,

Yeah I know this. Your solution solved the problem for me, many thanks. My original string replace also solves this issue.

My issue turned out to be the output of the debugger that was not as expected. It prints the double double quotes even though the new string does not contain them. I think if does this for reopening the string after the first double quote closes it.

Many thanks

Chris