Permalink
Browse files

Added of:formatThousands()

  • Loading branch information...
BalusC committed Feb 2, 2016
1 parent a2c1473 commit 472ced3eecc3d3b6ca31d913d28206146326c711
Showing with 31 additions and 0 deletions.
  1. +31 −0 src/main/resources/META-INF/omnifaces-functions.taglib.xml
@@ -724,6 +724,37 @@
<function-signature>java.lang.String formatPercent(java.lang.Number)</function-signature>
</function>
<function>
<description>
<![CDATA[
Format the given number to nearest 10<sup>n</sup> (rounded to thousands), immediately suffixed (without space)
with lowercased IEC unit (k, m, g, t, p and e), rounding half up with a precision of 3 digits, whereafter
trailing zeroes in fraction part are stripped. Numbers lower than thousand are not affected.
For example (with English locale):
<ul>
<li>999.999 will appear as 999.999
<li>1000 will appear as 1k
<li>1004 will appear as 1k
<li>1005 will appear as 1.01k
<li>1594 will appear as 1.59k
<li>1595 will appear as 1.6k
<li>9000 will appear as 9k
<li>9900 will appear as 9.9k
<li>9994 will appear as 9.99k
<li>9995 will appear as 10k
<li>99990 will appear as 100k
<li>9994999 will appear as 9.99m
<li>9995000 will appear as 10.0m
</ul>
The format locale will be set to the one as obtained by <code>Faces#getLocale()</code>.
If the value is <code>null</code>, <code>NaN</code> or infinity, then this will return <code>null</code>.
]]>
</description>
<function-name>formatThousands</function-name>
<function-class>org.omnifaces.el.functions.Numbers</function-class>
<function-signature>java.lang.String formatThousands(java.lang.Number)</function-signature>
</function>
<!-- Objects ================================================================================================== -->
<function>

0 comments on commit 472ced3

Please sign in to comment.