Java 如何解析德国货币数字属性?
我正在分析德国的货币数字。但是下面的测试有什么问题吗Java 如何解析德国货币数字属性?,java,currency,Java,Currency,我正在分析德国的货币数字。但是下面的测试有什么问题吗 NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00"); 结果: java.text.ParseException: Unparseable number: "100,00" at java.text.NumberFormat.parse(NumberFormat.java:350) 如果要在不使用货币的情况下解析数字,请使用: NumberFormat.g
NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00");
结果:
java.text.ParseException: Unparseable number: "100,00"
at java.text.NumberFormat.parse(NumberFormat.java:350)
如果要在不使用货币的情况下解析数字,请使用:
NumberFormat.getInstance(Locale.GERMANY).parse("100,00");
如果使用getCurrencyInstance
还必须提供欧元符号:
NumberFormat.getCurrencyInstance(Locale.GERMANY).parse("100,00 €");
您不需要字符串中的“€”符号吗?