String .Replace Query

Hello automation gurus

I have a question regarding the .Replace function of a string. I am reading a pdf and passing the content out as a string. In the string it contains:

var myString = "The "Company" is"

I understand that myString.Replace("""Company""","XXX") will return me "The XXX is"

However, i have a situation where the string is something like

var myString2 = "The “Company” is"
When I do a similar myString.Replace("““Company””","XXX"), it stills returns me "The “Company” is" which is wrong. Expectation is it should return "The XXX is"

Any idea how to handle such?

Advance thanks!
Jack

Hi,

In this case we need to use like the following expression. Probably because of normalization matter of Studio.

myString2.Replace(ChrW(8220)+"Company"+ChrW(8221),"XXX")

Regards,

Hi @Yoichi

Thanks for the help! It worked like a charm! :grinning: :grinning:

1 Like

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