Re: NumberFormat Question
Re: NumberFormat Question
- Subject: Re: NumberFormat Question
- From: LD <email@hidden>
- Date: Sun, 30 Jan 2005 00:21:45 +1100
Hi there,
On 28/01/2005, at 3:08 AM, Albert Jagnow wrote:
This is kind of a silly picky question, but I am not sure how to get
the number format to be consistent in one of my applications. I have
an application that stores numerical data in a DB2/400 database in a
Decimal field. I have a page which displays a calculation as a
BigDecimal from the data in that column. The numberformat is set to
"0.##" The result I expect is if the data is 0 to display 0, if it is
2 to display 2 and if it is 2.3333 to display 2.33.
public MyFlexiDecimalPlacesNumberFormatter extends NSNumberFormatter {
<...>
public String stringForObjectValue(Object inNumber) {
String result = super.stringForObjectValue(inNumber);
if (result.endsWith(".00")) {
return result.substring(0, result.length() - 3);
}
return result;
}
<...>
}
or something similar if you don't want to subclass.
--Albert
with regards,
--
Lachlan Deck
_______________________________________________
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