Earlier I have talked (and held a vote) about extended format strings,
but as reminder, for a while in 2.3.24 nightly you can do things like
this:

  ${n?string("#.00;; rnd=hu inf='∞'")}

or set the number_format setting to something like that. The thing to
note is the section after the 2nd ";", which is not allowed be
DecimalFormat (as it only supports two sections), it's an extension by
FreeMarker.

How should the option names look? Like instead of the current
abbreviated form, it could be like "#.00;; rounding='half-up'
infinity='∞'" too. Currently it's like below. Opinions?


rnd
  Rounding mode. The value is one of u for up, d for down, c for
  ceiling, f for floor, hu for half-up, hd for half-down, he for
  half-even, and un for unused. (See the java.math.RoundingMode API
  for explanations.)

mul
  Multiplier. The number will be shown after multiplied with this
  integer number.

dec
  Decimal separator character (like "." in 3.14).

mdec
  Monetary decimal separator character. This is used instead of dec
  when the pattern contains parts that make it a monetary format. (See
  the Java decimal number format documentation for more.)

grp
  Grouping separator character. Note that grouping is turned on by
  using "," in the patter, as shown in the earlier example. If it's
  not turned on, this option won't have visible effect.

exp
  Exponent separator string. Only has visible effect if the pattern
  specifies exponential form, like "0.##E0".

min
  Minus sign character.

inf
  The string used to show infinity.

nan
  The string used to show not-a-number (NaN).

prc
  Percent character.

prm
  Per-mill character.

zero
  Zero character. This modifies the other digits too, for example, if
  zero is A, then 1 will B, 2 will be C, and so on.

curc
  Currency ISO 4217 code. Only has effect when the pattern contains
  parts that make it a monetary format. It's an error to specify a
  code that's not a known ISO 4217 code in the Java installation.

curs
  Currency symbol; shown where the localized currency name is present
  in the pattern. Overrides the symbol determined from curc.

-- 
Thanks,
 Daniel Dekany

Reply via email to