1104
Views
6
Comments
Solved
Unable to replace using replace function from "" with double quote (")
Question

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.

Test.html
2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

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
2022-10-07 14-10-51
NNG

Thanks! old thread but helpful

2016-04-22 00-29-45
Nuno Reis
 
MVP
Solution

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.

2022-10-07 14-10-51
NNG

Thanks! old thread but helpful

UserImage.jpg
Jorge Guerreiro

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

2021-09-06 15-09-53
Dorine Boudry
 
MVP
Solution

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
2022-10-07 14-10-51
NNG

Thanks! old thread but helpful

UserImage.jpg
António Matos

 You can use CHR(34), for example

for the text: "expression" you can do this CHR(34)+ "expression"+ CHR(34) and the result will be

"expression".

Let me know if worked for you

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.