1956
Views
6
Comments
Solved
Replacing double quotes
Question

Hi

I need to convert double quote occurring two times into single occurrence.

Example : ""profession"" as "profession"

I tried using  EncodeHTML to read the double quotes and then replace but its not working. 

Any pointers for the same??I don't want to create function in java script and do the logic.

The below obviously is not working due to literal mismatch but that's what i was trying.

SyntaxEditor Code Snippet

Replace(Text,EncodeHtml(""""),""")




2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Tanuj,

You were trying in the right direction. Within string literals, you need to put two double quotes for every single one. So your replace should look like this:

Replace(Text, """""", """")

(So that's four double quotes representing two double quotes, between the normal string literal double quotes, or six in total, as the second argument, and two double quotes representing a single double quote, between two string literal double quotes, or four in total, as the third argument of Replace.)

UserImage.jpg
Tanuj Agarwal

Kilian Hekhuis wrote:

Hi Tanuj,

You were trying in the right direction. Within string literals, you need to put two double quotes for every single one. So your replace should look like this:

Replace(Text, """""", """")

(So that's four double quotes representing two double quotes, between the normal string literal double quotes, or six in total, as the second argument, and two double quotes representing a single double quote, between two string literal double quotes, or four in total, as the third argument of Replace.)

No it didn't worked. It's trying to match four quotes and replace it with two.


Before Replace :

""profession"": ""RN"",
   ""metro"": """",
   ""jobURL"": """","

SyntaxEditor Code Snippet

Replace(HtmlToText.Text,(""""""),(""""))

After Replace :

""profession"": ""RN"",
   ""metro"": "",
   ""jobURL"": "","




2018-05-16 11-16-36
João Heleno
 
MVP

@Tanuj

Try without EncodeHtml.

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

Hi Tanuj,

You were trying in the right direction. Within string literals, you need to put two double quotes for every single one. So your replace should look like this:

Replace(Text, """""", """")

(So that's four double quotes representing two double quotes, between the normal string literal double quotes, or six in total, as the second argument, and two double quotes representing a single double quote, between two string literal double quotes, or four in total, as the third argument of Replace.)

UserImage.jpg
Tanuj Agarwal

Kilian Hekhuis wrote:

Hi Tanuj,

You were trying in the right direction. Within string literals, you need to put two double quotes for every single one. So your replace should look like this:

Replace(Text, """""", """")

(So that's four double quotes representing two double quotes, between the normal string literal double quotes, or six in total, as the second argument, and two double quotes representing a single double quote, between two string literal double quotes, or four in total, as the third argument of Replace.)

No it didn't worked. It's trying to match four quotes and replace it with two.


Before Replace :

""profession"": ""RN"",
   ""metro"": """",
   ""jobURL"": """","

SyntaxEditor Code Snippet

Replace(HtmlToText.Text,(""""""),(""""))

After Replace :

""profession"": ""RN"",
   ""metro"": "",
   ""jobURL"": "","




2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Tanuj,

You are being rude, and incorrect. It is not "trying to match four quotes", not "replace it with two". It's replacing two quotes with one. I've attached an example to show that it works.

QuoteReplaceTest.oml
2018-06-01 14-41-55
Clara Cruz Correia

We need 2 quotation marks to enclose something in a string and a double quotation mark writes one as text. 

So if we want to print the text: he said "Hi" to me; we need to do : "he said ""Hi"" to me".

The suggestion of Kilian works, so thanks =)

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

You're welcome :)

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