DecimalFormat multi-language, localization specified Locale

DecimalFormat will use the default Locale if it does not specify a Locale. Different Locales will cause unexpected phenomena during formatting. For example, when Locale is Spain, the decimal point symbol is ", and the "thousands separator" is ".".
Therefore, when using multiple languages ​​or requiring localization, it is best to specify Locale when using DecimalFormat to avoid formatting exceptions.
 

new DecimalFormat("格式化文本", new DecimalFormatSymbols(Locale.US));


 

Guess you like

Origin blog.csdn.net/yzwfeng/article/details/133702375