How to Remove " from a string of Variables


I’ scraping data from a website and some of the data points come like “product 1” and price comes as “Rs. 100.00”, in both cases the scraped data comes within " sign.

Hence when i try to remove or replace using string manipulation it gives me the message that expression must be closed with double quotes since it thinks i’m opening one when put the expression variable.Replace(“”“,” ").

How can i remove the " from the data via string manipulation or is there some other method.

Hi @tharinda,

You can try with below code.

variable.Replace("\"", ""); 

Thanks Varun but still get the same error message ‘String constants must end with a double quote’

Can you attach a screenshot?

Input=“100” OutPut: 100

Thanks, but if you say Input=“100”, anyway the output will be 100. If you want to get “100” as output if you say Input="“100"” you can not do this. Then you get the same error

Is your input format is same or not?

varprice = varprice.Replace("""","") will work, you need 4 double quotes in the first parameter: 1 and 4 are the start and end and 2 and 3 are how you tell UiPath to literally use ".

You can also do varprice = varprice.Replace(chr(34),"") which will replace ascii character 34 which is the double quote.

1 Like

Hi @tharinda

You can read this article for your reference.

cheers :smiley:

Happy learning :smiley:

1 Like

Put it in while loop
say Variable.contains(“)
it will remove all "

1 Like

Thanks a lot for this. Really informative. Appreciate the share. :pray:

1 Like

Thanks for this, it worked.

1 Like

Hi, Thanks a lot for this, it worked.

Apologies for the delay.

Also just as a side note discovered that if you need to add double quotes into a variable (For what ever the reason :slight_smile: you need to do variable=“”“100"”" for example. Just in case anyone needs to do that.

1 Like

You welcome!

Happy Automation

1 Like

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