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

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?


-- 
Paul.

w  http://logicsquad.net/
h  http://paul.hoadley.name/


 _______________________________________________
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: Chuck Hill <email@hidden>
  • Prev by Date: Re: Confusing lock error solved, but now a restoreSessionWithID lock issue
  • Next by Date: Re: Confusing lock error solved, but now a restoreSessionWithID lock issue
  • Previous by thread: Re: Confusing lock error solved, but now a restoreSessionWithID lock issue
  • Next by thread: Re: Formatting a BigDecimal in a WOString
  • Index(es):
    • Date
    • Thread