• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NumberFormat Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NumberFormat Question (From: "Albert Jagnow" <email@hidden>)

  • Prev by Date: Re: WO Adaptor build falining on OSX 10.3.7 w/ "unable to infer tagged configuration" ... ?
  • Next by Date: Re: Apps that don't release unused sessions
  • Previous by thread: NumberFormat Question
  • Next by thread: FetchSpecification with limit and display group
  • Index(es):
    • Date
    • Thread