Number Formatter class omits the digits after 2 decimal places

29 views
Skip to first unread message

Atul

unread,
Sep 5, 2011, 12:42:06 PM9/5/11
to Google Web Toolkit
Hi,

I want to change a double value to USD currency format, so i used
NumberFormat class of com.google.gwt.i18n.client.NumberFormat package.
So when i say NumberFormat.getCurrencyFormat().format(doubleValue) it
returns me string in US$ format but only upto 2 places of decimal. I
don't want to loose original fraction values. There is no method in
this class as setMaximumFractionDigits(int newValue) in
java.text.NumberFormat. Please help me.

Jens

unread,
Sep 5, 2011, 1:28:06 PM9/5/11
to google-we...@googlegroups.com
You can always use NumberFormat.getFormat(String pattern) to provide your own custom pattern or you use NumberFormat.getCurrencyFormat(CurrencyData data). You can try to use DefaultCurrencyData or provide your own implementation of CurrencyData.

-- J.
Reply all
Reply to author
Forward
0 new messages