Compact Number Formatting and Fraction Digits
Gunnar Morling
gunnar at hibernate.org
Thu Jan 17 09:07:41 UTC 2019
Hi,
I took a look at the compact number formatting recently added in JDK 12.
There's setMinimumFractionDigits() to control the number of fractional
digits, so that e.g. 1,500 can be formatted as 1.5K. That's great, but
it also will format 1,000 as 1.0K. Is there a way to have fractional
digits but remove trailing zeros, so that 1,500 and 1,000 would be
formatted as 1.5K and 1K, respectively?
Thanks,
--Gunnar
More information about the core-libs-dev
mailing list