Re: int to NSString?
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