formatNumber"
From Documentation
(3 intermediate revisions by 2 users not shown) | |||
Line 11: | Line 11: | ||
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"> | |
− | <source lang=" | + | <?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?> |
− | + | <zk> | |
+ | <label value="${c:formatNumber(2332315231, '$ ###,###,###.00')}" /> | ||
+ | </zk> | ||
</source> | </source> | ||
− | : | + | There is another extended built-in function, not declared in taglib: <javadoc method="formatNumber(java.lang.Object, java.lang.String, java.util.Locale)">org.zkoss.xel.fn.CommonFns</javadoc>. |
− | |||
− | |||
− | You can | + | You can call it by [[ZUML%20Reference/EL%20Expressions/Static%20Fields%20and%20Methods| EL]] or declaring a [[ZUML_Reference/ZUML/Processing_Instructions/xel-method| xel-method]]. |
Revision as of 07:54, 27 May 2021
The default method:
String formatNumber(Object number, String pattern);
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>
<label value="${c:formatNumber(2332315231, '$ ###,###,###.00')}" />
</zk>
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 function:
- number - the Number to format
- pattern - the pattern to apply
In extended function only:
- locale - the locale to apply
Version History
Version | Date | Content |
---|---|---|
6.0.1 |