• 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
decimal floating formatting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

decimal floating formatting question


  • Subject: decimal floating formatting question
  • From: Mark Dawson <email@hidden>
  • Date: Wed, 22 Dec 2004 15:59:49 -0800

Is there a way to format a decimal number with no trailing zeros and show only "X" number of digits? I would like 1.0 to show up as "1", 1.2 as '1.2";, 1.31457 as "1.3146".

I'm familiar with the "%.4f" type format, but while this limits the output to 4 decimal points, it adds trailing zeros (i.e., "1.2000"). Is there a way to the best of both worlds via a formatting option?

Thanks!

mark

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: decimal floating formatting question
      • From: Jonathan Jackel <email@hidden>
    • Re: decimal floating formatting question
      • From: Jonathan Jackel <email@hidden>
    • Re: decimal floating formatting question
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: NSArrayController and threading
  • Next by Date: Re: Finder vs. Quartz performance.
  • Previous by thread: Re: Finder vs. Quartz performance.
  • Next by thread: Re: decimal floating formatting question
  • Index(es):
    • Date
    • Thread