Unable to replace using replace function from "" with double quote (")

Hi,

We are working on a OS project where we consuming external .Net WebAPIs. As a part of implementation, we had requirement to fetch HTML using Web-APIs and show on UI screen.

Under fetched HTML, we had some inline JS functions too for its own functioning.


Currently, we are getting HTML like below snippet

<html id=""StylesheetReport""><head><meta content=""IE=8"" http-equiv=""X-UA-Compatible""></meta><style............


When we use inbuilt function to replace 2 times double quote ("") to a double quote (") under expression, it does not allow since it requires always character and throws compilation error.

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


But, when we try to replace above string to single quote ('), it works for HTML but breaks JS functions   which breaks HTML functioning.

Replace(string, """", "'");


PFA Web-API output as HTML.


Please advise.

Hi Subhash.


You made a mistake in Replace(string, """", """).

Here you are not replacing two double quotes with one. The "" is how you represent " inside " ". So the 4 " symbols represent a single ". And the 3 symbols are not only wrong but invalid.


When you use Replace(string, """", "'") you are replacing one " by one '. Therefore, replacing "" with '' (two single quote, not one double quote).


What you want is Replace(string."""""","""") [6 and 4 times] replace two double quotes by one double quote.

Ok, so I have yet to see how the replace function, can change this from two double-quotes to one.

{""d"":{""results"":[{""vendorInvestingNumber"":""MSL04550BULK""}]}} 

It seems all the posts herein, at least the ones that I have read, are asking the same thing. Looking for some assistance.

Thank you

Well Jorge,

exactly like Nuno said in 2019 will work, what about it don't you get ?

maybe color code to explain what Nuno is proposing : 

Replace(Original,"""""","""")

RED = quotes around the literal string parameters of the replace formula

GREEN = first double quote of the to be replaced pair, represented by 2 " symbols

YELLOW = second double quote of the to be replaced pair, represented by 2 " symbols

BLUE = resulting replacement, only one double quote, represented by 2 " symbols

Dorine