• 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: String Formating
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String Formating


  • Subject: Re: String Formating
  • From: Dominik Pich <email@hidden>
  • Date: Sat, 16 Dec 2006 14:04:35 +0100

Use of an NSNumberFormatter?!

Am Dec 16, 2006 um 9:31 AM schrieb email@hidden:

I wish to format a tring from a floting point value.
right now i'm using
return [NSString stringWithFormat:@"%.2fGB",gigabytes];

witch is perfect if there is 1.25GB
but i would also like to display it as 1GB if the number turn's out
to be 1.00
is it possible to make the format conditional?

Yup.

if ( x > 1.0 )
{
    //format 1
}
else
{
    //format 2
}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >String Formating (From: email@hidden)

  • Prev by Date: CoreData/NSManagedObject accessor performance problems
  • Next by Date: Re: Efficient comparing of two directories
  • Previous by thread: String Formating
  • Next by thread: Resizing drag image during drag?
  • Index(es):
    • Date
    • Thread