• 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: Formatting a BigDecimal in a WOString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formatting a BigDecimal in a WOString


  • Subject: Re: Formatting a BigDecimal in a WOString
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 7 Nov 2008 17:43:43 -0800


On Nov 7, 2008, at 3:49 PM, Paul Hoadley wrote:

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?

Punt? I might be a bug in NSNumberFormatter. I usually use the formatter binding rather than the format string bindings (dateFormat and numberFormat). You could try that and pass back an instance of a Java formatter, e.g. java.text.NumberFormat.



Chuck

--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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
  • Follow-Ups:
    • Re: Formatting a BigDecimal in a WOString
      • From: Paul Hoadley <email@hidden>
References: 
 >Formatting a BigDecimal in a WOString (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Confusing lock error solved, but now a restoreSessionWithID lock issue
  • Next by Date: Re: Update & Delete of an Enterprise Object causes EOEditingContext.saveChanges() to Exception
  • Previous by thread: Formatting a BigDecimal in a WOString
  • Next by thread: Re: Formatting a BigDecimal in a WOString
  • Index(es):
    • Date
    • Thread