$ 12,345,60, 12 540 420 $.. given currency strings with currency symbol that could be at the begging or at the end, I'd like to strip the currency symbol.
With the above examples, the output should be
$ 12,345,60 -> 12,345,60
12 540 420 $ -> 12 540 420
12 456 700 -> 12 456 700
The easiest way of course is to check if the first or the last character is digit and otherwise remove it. I was wondering if it can be done using regex or any other better ways to do this. many thanks in advance.
via LCYSoft
No comments:
Post a Comment