I am looking to extract a currency amount but without the currency before it. For example from the below i want the figures and not the currency sign how can i go about it?
£1100.01
$520.00
SGD 503.00
I have tried using trim but its not accurate, would i need regex coding?
Filter your text with System.Text.RegularExpressions.Regex.Matches(MyText, "\d+(\.\d+)*"), where MyText is the text you’ve extracted. Then each match can be converted to a double if need be, but will only contain 1100.01, 520.00, and 503.00 as shown in your example above.
I seem to be getting more errors when changing the variable to string.
Let me add some more info may help clear things up a bit, right so am using get text to extract the figure, which when am storing the data its in a generic variable as its picking up the currency.
I then want to put the figure without the currency sign in an if statement to say ‘Amount > 500’ then do this else do this.
Because its picking up the currency everytime, the bot keeps going down the ‘else’ line
When you extract text, it should be stored as a string. If you need it to be used as a value for comparison as in Amount > 500, if Amount is a string, you can use CDbl(Amount) > 500.
The System.Text.RegularExpressions…etc. should be assigned to a variable of type MatchCollection. You can the iterate over this collection to get the value of each match. If item is one of the items in the collection, you can get the string you want from item.Value.