I want to parse a String that i have into a Number. This is the Code that i'm using but not working:
NumberFormat.getCurrencyInstance(Locale.GERMAN).parse("EUR 0,00");
This results in a java.text.ParseException
So i want to match the String into a number, i don't really care about the currency, but it would be nice to have.
I want the following kind of Strings matched:
EUR 0,00
EUR 1.432,89
$0.00
$1,123.42
1,123.42$
1,123.42 USD
Sure, there are ways with RegEx, but i think it would be kind of overkill.
Locale.GERMAN does not seem to have a currency symbol. Locale.GERMANY has the euro symbol as its currency (not the string "EUR"). Notice that blam1 and blam3 below cause parsing exceptions, the CurrencyFormat object only likes blam2.
I suspect that you will need to either find an open source currency parser that fits your need or write one yourself.