formatNumber"

From Documentation
m
Line 10: Line 10:
  
 
Formats a number (Integer, BigDecimal...) into a string with the given pattern.
 
Formats a number (Integer, BigDecimal...) into a string with the given pattern.
 +
 +
For example,
 +
<source lang="xml">
 +
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>
 +
<zk>
 +
    <textbox value="${c:formatNumber(2332315231, '###,###,###')}" />
 +
</zk>
 +
</source>
  
 
There is another extended built in function,  
 
There is another extended built in function,  

Revision as of 07:35, 2 May 2012

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="http://www.zkoss.org/dsp/web/core" prefix="c"?>
<zk>
    <textbox value="${c:formatNumber(2332315231, '###,###,###')}" />
</zk>

There is another extended built in function,

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

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

You can define a method to use this function by xel-method


Parameters: In both default and extended function:

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

In extended function only:

  • locale - the locale to apply

Version History

Last Update : 2012/05/02


Version Date Content
6.0.1    



Last Update : 2012/05/02

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