From Documentation

Since 6.0.1

The default method:

String formatNumber(Object number, String pattern);
i.e., CommonFns.formatNumber(Object, String)

Formats a number (Integer, BigDecimal...) into a string with the given pattern.

For example,

<?taglib uri="" prefix="c"?>
    <label value="${c:formatNumber(2332315231, '$ ###,###,###.00')}" />

There is another extended built-in function, not declared in taglib: CommonFns.formatNumber(Object, String, Locale).

You can call it by EL or declaring a xel-method.

Parameters: In both default and extended functions:

  • number - the Number to format
  • pattern - the pattern to apply

In extended function only:

  • locale - the locale to apply

Last Update : 2023/08/08

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.