Skip to content

Instantly share code, notes, and snippets.

@marschall
Created March 5, 2019 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marschall/8f21fe49a127fa9eb4951dadd99a7060 to your computer and use it in GitHub Desktop.
Save marschall/8f21fe49a127fa9eb4951dadd99a7060 to your computer and use it in GitHub Desktop.
Decimal Formatting Changes in Java 11
class SwissDecimalFormatTest {
@Test
void decimalFormat() {
Locale switzerland = new Locale("de", "CH");
DecimalFormat format = (DecimalFormat) NumberFormat.getInstance(switzerland);
format.applyPattern("#,##0.00");
String formatted = format.format(new BigDecimal("1234567.8"));
assertEquals("1'234'567.80", formatted);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment