Replace text within string "" with \" \"

Hi All,

If I want to replace any string “” with " " what should be the expressions be like. For example, my original string is “Incident”.

I want as "Incident"

@dutta.marina,

If you want your string to have “” inside sting you can use it like """Incident"""

Thanks,
Ashok :slight_smile:

check this post

@ashokkarale

I want in below format. Ignore the dot

image

Hi @dutta.marina

Try this

Input.Replace("“", """").Replace("”", """")

Regards,

@dutta.marina

originalString.Replace("""", "\""")

1 Like

@dutta.marina,

Yes, the above solution will return you the required format. See:

Also, " is a escape sequence used in programming to display ". You cannot really replace it.

Thanks,
Ashok :slight_smile:

@lrtetala

@dutta.marina

From where do you get the input?

Regards

@lrtetala

Actually I am uploading JSON Data. There is an error in Incident word which is withing double quotes. If I replace with

the error resolved

@dutta.marina,

If your “Incident means” is fixed text, use stringVariable.Replace("Incident means","""Incident means""")

This should resolve your issue.

Thanks,
Ashok :slight_smile:

@dutta.marina

Try this

jsondata.Replace("“", """").Replace("”", """")

Regards,

@ashokkarale @rlgandu @lrtetala

Thanks everyone for your kind help. The below expression worked for me.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.