Formatting a BigDecimal in a WOString
Formatting a BigDecimal in a WOString
- Subject: Formatting a BigDecimal in a WOString
- From: Paul Hoadley <email@hidden>
- Date: Sat, 8 Nov 2008 10:19:14 +1030
Hello,
I'm having trouble getting a WOString to format a java.math.BigDecimal. Here's an example of what I'm doing:
sumString : WOString { value = stats.sum; numberformat = numberFormat; }
'stats.sum' returns a BigDecimal. 'numberFormat' returns the string '#.######'---my intention is to display the BigDecimal in standard (non-scientific) notation, to a maximum of 6 decimal places. If I have 'stats.sum' returning a value in scientific notation, say "2.8E+2", it passes through the number formatter unaffected, and the string "2.8E+2" is displayed on the page. If I change 'value' to 'stats.sum.toPlainString' and comment out the 'numberformat' line, I get the value in standard notation, but then if I have a number with, say, 10 decimal places, it obviously no longer gets truncated as desired. What's the best way around this?
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden