nightingale2k1 nightingale2k1 - 4 months ago 8x
Java Question

formatNumber : how to add 2 decimal digits at the back of numbers?

I am using grails formatNumber and I would like to display my numbers in decimal format.

I would like to display 10 as 10.00
or 0 as 0.00 with 2 decimal digits.

how to do that ?


I believe that you were looking for how to do this with Grails' formatNumber tag

<g:formatNumber number="${10}" format="0.00"/>
<g:formatNumber number="${0}" format="0.00"/>

results in


The formatNumber tag uses DecimalFormat for the format parameter