Re: convert int to NSString
Re: convert int to NSString
- Subject: Re: convert int to NSString
- From: John Randolph <email@hidden>
- Date: Wed, 21 Apr 2004 22:31:52 -0700
On Apr 21, 2004, at 9:40 PM, Sherm Pendley wrote:
On Apr 22, 2004, at 12:18 AM, Adam wrote:
If I have an int
(int x = 27)
how do I convert it into an NSString so I can display it somewhere in
the GUI?
A couple ways I can think of:
NSString *sx;
sx = [NSString stringWithFormat:@"%d", x];
sx = [[NSNumber numberWithInt: x] stringValue];
Personally, I'm partial to the latter, since it doesn't require a
constant string object or the overhead of parsing a format string. Not
that it would matter much unless you're doing this a few thousand times
a second.
-cjr
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.