How can I remove the " character at the begining and end of a string?

Hi guys,
I’m sure it is easy, but I’m stuck.
I have this complex formula I have to write in an Excel cell.
I can’t use directly the write cell activity, because the formula has a lot of " and = and () and UiPAth is confused.
So I put the formula in a variable, the cell ends up written, but with the " " at the begining and end of the formula.
How can I remove the first and last character in a string, and not touch the rest ?
Thanks guys

Hi @remy2283 ,

To Trim the Double Quotes at the Ends we can use Trim.

Could you try using the below Expression :

Let’s Say your variable is varStr.

varStr.Trim("""") should give you the trimmed double quotes value.

Hi

Have a view on this thread for more ideas

Cheers @remy2283

Hi, thanks for the answer, but UiPath does not want that, it says :
Option Strict disallows implicit conversions from String to Char

Hi Palaniyappan, thanks but no, I don’t want to replace my " characters, in need them in my formula, I just need to get rid of the first and last "

Hi @remy2283 ,

Could you share your formula. while writing formula in your assign replace the double quotes with CHR(34) it would not throw any errors. thanks.

@remy2283 , Apologies.

Can you Update the Expression to below and let us know what is the outcome :

varStr.Trim("""".ToCharArray)

This worked @supermanPunch
Thank you so much, you’re awesome !

1 Like

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