Java provides a good way to format currencies using major symbols depending on a given locale. For example, if the given currency is US dollar, then you can achieve $0.35
or USD0.35
for US and UK locales respectively. That's really fine.
Nevertheless, in some cases, there is need to format money amounts in another, I would say more user-friendly, style using minor currency symbols. For example, 35¢
or 35c
instead of the examples above. Wikipedia also says:
Cent amounts from 1 cent to 99 cents can be represented as one or two digits followed by the appropriate abbreviation (2¢, 5¢, 75¢, 99¢)
However, I can't find any way to format money amounts in this style using JDK. I've already tried to play with DecimalFormatSymbols
, but this only allows to configure the major currency symbol, so DecimalFormat
still uses the original format, giving something like ¢35
which is not fine. Also a custom format string to fix the order may not be a locale/language/country-agnostic (in-between space? prefix or suffix notation?). Joda Money and its MoneyFormatter seem to lack this feature as well.
Is there a good way to format money amounts using minor currency symbols? Thanks in advance.
P.S. I'm not sure if words "major" and "minor" suit here well.