From: PJ Fanning Date: Thu, 3 Feb 2022 15:27:23 +0000 (+0000) Subject: [bug-62857] support locale X-Git-Tag: REL_5_2_1~111 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6200f7975895c28fc89ab13c095d776891436960;p=poi.git [bug-62857] support locale git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897730 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java index 3a3bc4760c..4402ed49d7 100644 --- a/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java +++ b/poi/src/main/java/org/apache/poi/ss/formula/functions/NumericFunction.java @@ -26,7 +26,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; import java.text.NumberFormat; public abstract class NumericFunction implements Function { @@ -104,20 +103,6 @@ public abstract class NumericFunction implements Function { val = bigInt.doubleValue(); } - StringBuilder decimalPlacesFormat = new StringBuilder(); - if (nPlaces > 0) { - decimalPlacesFormat.append('.'); - } - for (int i = 0; i < nPlaces; i++) { - decimalPlacesFormat.append('0'); - } - StringBuilder decimalFormatString = new StringBuilder(); - decimalFormatString.append("¤#,##0").append(decimalPlacesFormat) - .append(";(¤#,##0").append(decimalPlacesFormat).append(')'); - - DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(LocaleUtil.getUserLocale()); - DecimalFormat df = new DecimalFormat(decimalFormatString.toString(), symbols); - DecimalFormat nf = (DecimalFormat) NumberFormat.getCurrencyInstance(LocaleUtil.getUserLocale()); int decimalPlaces = nPlaces < 0 ? 0 : nPlaces; if (LocaleUtil.getUserLocale().getCountry().equalsIgnoreCase("US")) {