Reputation: 10652
I have a decimal number that was formatted using DecimalFormat. When It was formatted I use decimal.setGroupingUsed(true) because I needed.
Now I need to do the reverse method, that is, I have a number with integer decimals grouped like this 3,200.95 and I want to obtain 3200.95 (remove grouping symbol).
I do not want to replace "," with "" as grouping symbol depends on the country. Some countries it is "." and some others "," so I have tried to use DecimalFormat by setting grouping to false:
decimal.setGroupingUsed(false)
but then I do not know how to proceed. Any ideas?
Upvotes: 1
Views: 1398
Reputation: 19661
You actually want setGroupingUsed to be true, since you expect those symbols to be in the string you're parsing. You'll use the parse method to turn that String into a Number.
Upvotes: 2