Converting Text Currency to a Real Number

I have a Text File in which I am gleaning Currency Amounts from the Text. I pull this data into a Data Table then parse the Text into Variables where ultimately they will be passed to a SQL Table for storage.

The problem I am having is that the Text Currency has a Dollar symbol in front of the number and no matter what I have tried, I cannot strip the Dollar symbol from the stored variable. This interferes with my Query to insert the values as a Number. Every attempt to convert the Data Table Data to a Real Number, Float, Int, Int32, Double has failed.

Example Error Message:

image

I want to do this without having to shell the data out to a CSV / Excel File where I can easily convert this to number and read it back in. I want to accomplish this task strictly within the UiPath Environment.

Here is some examples of what I have tried that did not work:
In an Assign Activity:
Prod_Rate_Mth = (Convert.ToDouble(row(5))), Also tried .ToInt16, .ToInt32
Tried Stripping the Dollar Symbol: System.Text.RegularExpressions.Regex.Replace(input_Text.ToString, "$", "").ToString.Trim()

I’m at a total loss as to why this cannot be done inside UiPath. Going down the road to farming the coding of the Currency amounts I need changed to a Double Type Number in and external process.

Any Help is appreciated!
Thanks!

1 Like

Hi @Terry_Mabry,

Hope this could help you, you can use Double.Parse Function with the following parameters:

Best regards,
Susana

6 Likes

@Susana ~ It worked!! :smiley: Wish I could return the favor, but maybe someday I can pay it forward to some else that needs help. :wink: Thank you so much!

1 Like

You are welcome :slight_smile: All of us learn from every post. There is always someone to help so glad to see you on the forum!!! :robot::robot::robot::robot:

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