如何解析德国货币数字属性?

mem*_*und 3 java currency

我正在尝试解析德国货币数字.但是下面的测试有什么问题?

NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00");
Run Code Online (Sandbox Code Playgroud)

结果:

java.text.ParseException: Unparseable number: "100,00"
    at java.text.NumberFormat.parse(NumberFormat.java:350)
Run Code Online (Sandbox Code Playgroud)

use*_*432 6

如果要在不使用货币的情况下解析数字:

NumberFormat.getInstance(Locale.GERMANY).parse("100,00");
Run Code Online (Sandbox Code Playgroud)

如果你使用,getCurrencyInstance你还必须提供€符号:

NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00 €");
Run Code Online (Sandbox Code Playgroud)