From notifications-return-5243-archive-asf-public=cust-asf.ponee.io@freemarker.incubator.apache.org Tue Mar 13 09:48:50 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 2F4F318064F for ; Tue, 13 Mar 2018 09:48:50 +0100 (CET) Received: (qmail 63363 invoked by uid 500); 13 Mar 2018 08:48:49 -0000 Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@freemarker.incubator.apache.org Delivered-To: mailing list notifications@freemarker.incubator.apache.org Received: (qmail 63354 invoked by uid 99); 13 Mar 2018 08:48:49 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2018 08:48:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 7D36D180678 for ; Tue, 13 Mar 2018 08:48:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -11.731 X-Spam-Level: X-Spam-Status: No, score=-11.731 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id f2ogZ66dnib0 for ; Tue, 13 Mar 2018 08:48:47 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 84D255F180 for ; Tue, 13 Mar 2018 08:48:46 +0000 (UTC) Received: (qmail 63325 invoked by uid 99); 13 Mar 2018 08:48:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2018 08:48:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2FEAAEB501; Tue, 13 Mar 2018 08:48:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ddekany@apache.org To: notifications@freemarker.incubator.apache.org Message-Id: <3a850da6a2bc43af8329ed514a92a33e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-freemarker git commit: Manual: Noting some common pitfalls when using extended Java decimal format Date: Tue, 13 Mar 2018 08:48:44 +0000 (UTC) Repository: incubator-freemarker Updated Branches: refs/heads/2.3-gae 54bd25b0e -> c630a41ab Manual: Noting some common pitfalls when using extended Java decimal format Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/c630a41a Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/c630a41a Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/c630a41a Branch: refs/heads/2.3-gae Commit: c630a41ab68059ba2e658aaea4281cd512b2f38e Parents: 54bd25b Author: ddekany Authored: Tue Mar 13 09:48:39 2018 +0100 Committer: ddekany Committed: Tue Mar 13 09:48:39 2018 +0100 ---------------------------------------------------------------------- src/manual/en_US/book.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/c630a41a/src/manual/en_US/book.xml ---------------------------------------------------------------------- diff --git a/src/manual/en_US/book.xml b/src/manual/en_US/book.xml index 231b607..52f67af 100644 --- a/src/manual/en_US/book.xml +++ b/src/manual/en_US/book.xml @@ -15568,6 +15568,13 @@ German people write: 12.345.678,00 extended Java decimal format + + You need at least FreeMarker 2.3.24 for these to work. + Before that, extended Java decimal format parts are just + silently ignored by + java.text.DecimalFormat. + + FreeMarker extends the Java decimal format patterns with extra options. These options are name-value pairs, specified after two semicolons (;;) at the end of the format @@ -15581,6 +15588,14 @@ Extended decimal format: ${10002.5?string[",000;; roundingMode=halfUp Standard decimal format: 10,002 Extended decimal format: 10_003 + + A very easy mistake to make is just using a single + semicolon instead of two. It won't even result in an error, as + java.text.DecimalFormat thinks you have just + specified some weird format for negative numbers. So remember to + use two semicolons. + + Above, in the extended decimal format, we have specified half-up rounding mode and group separator "_". The table of all options follows (note that these are defined by