Created
March 5, 2019 09:05
-
-
Save marschall/8f21fe49a127fa9eb4951dadd99a7060 to your computer and use it in GitHub Desktop.
Decimal Formatting Changes in Java 11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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