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

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.


  • Follow-Ups:
    • Re: convert int to NSString
      • From: Ondra Cada <email@hidden>
References: 
 >convert int to NSString (From: Adam <email@hidden>)
 >Re: convert int to NSString (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Creating a criteria search view
  • Next by Date: Re: Creating a criteria search view
  • Previous by thread: Re: convert int to NSString
  • Next by thread: Re: convert int to NSString
  • Index(es):
    • Date
    • Thread