How to parse German currency numbers properly?

currency, java

Solution

If you want to parse the number without using currency use:

NumberFormat.getInstance(Locale.GERMANY).parse("100,00");

If you use `getCurrencyInstance` you have to also supply the € symbol:

NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00 €");

Problem

I'm trying to parse german currency numbers. But what's wrong with the following test? ``` NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00"); ``` Result: ``` java.text.ParseException: Unparseable number: "100,00" at java.text.NumberFormat.parse(NumberFormat.java:350) ```

Original source