You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Javen O'Neal <on...@apache.org> on 2017/07/03 12:53:38 UTC

Fwd: Re: [apache/poi] Trailing commas custom formats (#56)

Luca has a question about PR #56 on GitHub. Seems relevant to some of the
recent internationalization work. Anyone more familiar with the subject
care to chime in on the GitHub PR?

---------- Forwarded message ----------
From: "Luca Martini" <no...@github.com>
Date: Jul 3, 2017 03:52
Subject: Re: [apache/poi] Trailing commas custom formats (#56)
To: "apache/poi" <po...@noreply.github.com>
Cc: "onealj" <ja...@gmail.com>, "Mention" <me...@noreply.github.com>

*@lucailmartini* commented on this pull request.
------------------------------

In src/java/org/apache/poi/ss/usermodel/DataFormatter.java
<https://github.com/apache/poi/pull/56#discussion_r125262302>:

> +
+        private static final Pattern endsWithCommas = Pattern.compile("(,+)$");
+        private BigDecimal divider;
+        private static final BigDecimal ONE_THOUSAND = new BigDecimal(1000);
+        private final DecimalFormat df;
+        private static final String trimTrailingCommas(String s) {
+            return s.replaceAll(",+$", "");
+        }
+
+        public InternalDecimalFormatWithScale(String pattern,
DecimalFormatSymbols symbols) {
+            df = new DecimalFormat(trimTrailingCommas(pattern), symbols);
+            setExcelStyleRoundingMode(df);
+            Matcher endsWithCommasMatcher = endsWithCommas.matcher(pattern);
+            if (endsWithCommasMatcher.find()) {
+                String commas = (endsWithCommasMatcher.group(1));
+                BigDecimal temp = BigDecimal.ONE;

hi @onealj <https://github.com/onealj>, did you have the chance to review
my comment?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/apache/poi/pull/56#discussion_r125262302>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AH9463AsYkjja0R3e55mwSvA4W4oxaRuks5sKMgEgaJpZM4NtMtJ>
.