• 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: int to NSString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: int to NSString?


  • Subject: Re: int to NSString?
  • From: Tomas Franzén <email@hidden>
  • Date: Mon, 25 Jun 2007 21:10:12 +0200

On 24 jun 2007, at 07.49, Devraj Mukherjee wrote:
How do I convert an int to an NSString? Also is there an NSInt or a
NSInteger class?

The easiest way is probably to use stringWithFormat:, like this:

NSString *string = [NSString stringWithFormat:@"%d", myInteger];

You can wrap that into a +stringWithInt: method in an NSString category, if desired. If you want to get fancy, there's NSNumberFormatter and all that.
As for a class to represent integers, you should probably use NSNumber (+numberWithInt:).


Tomas Franzén
Lighthead Software
http://www.lightheadsw.com/

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >int to NSString? (From: "Devraj Mukherjee" <email@hidden>)

  • Prev by Date: Re: ObjC 3D engine
  • Next by Date: Re: Adding files to iTune library in Cocoa app
  • Previous by thread: Re: int to NSString?
  • Next by thread: Finder window - coordinates and screen?
  • Index(es):
    • Date
    • Thread