문제

This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand.

When using the MesssageFormat class, is it possible to get access to the NumberFormat object it uses to format currency strings. When you create a NumberFormat instance yourself, you can specify attributes like precision and rounding used when creating currency strings.

I have an issue where for the South Korean locale ("ko_KR"), the MessageFormat class seems to create currency strings w/ rounding (100.50 -> ₩100).

In areas where I use NumberFormat directly, I set setMaximumFractionDigits and setMinimumFractionDigits to 2 but I can't seem to set this in the MessageFormat.

Any ideas?

도움이 되었습니까?

해결책 2

I've determined that gaining access to the internal formatter used is not possible. I've opened a ticket with the ICU project. http://bugs.icu-project.org/trac/ticket/7571#preview

다른 팁

Probably because one Korean Won is worth $0.00088. They don't have pennies.

Same idea with the Swiss Franc, the 1 centime coin stopped being legal tender in 2007.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top