• 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 (Newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: convert int to NSString (Newbie)


  • Subject: Re: convert int to NSString (Newbie)
  • From: "Sean McBride" <email@hidden>
  • Date: Tue, 22 Feb 2005 09:27:26 -0500
  • Organization: Rogue Research

On 2005-02-21 16:21, Justin Spahr-Summers said:

>What's there to localize? Besides, the NSNumber descriptionWithLocale:
>method simply uses %i as a format string with NSString, so there's no
>difference, except that method allocates an unneeded object.

I am referring to the localisation options in System Preferences >
International > Formats > Numbers.  I tried this code:

 int intValue = 10000000;
 NSString*	str;

 str = [NSString stringWithFormat:@"%d", intValue];
 str = [[NSNumber numberWithInt: intValue] stringValue];

And both methods give the string "10000000".  I had incorrectly assumed
the second method would give a string like "10 000 000", "10,000,000",
etc. (depending on localisation settings).

Strings displayed to the user should honour their chosen format, but I
guess I don't know how that's done. :(  Anybody?

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: convert int to NSString (Newbie)
      • From: Ricky Sharp <email@hidden>
References: 
 >Re: convert int to NSString (Newbie) (From: Justin Spahr-Summers <email@hidden>)

  • Prev by Date: Document with more than one window
  • Next by Date: Re: convert int to NSString (Newbie)
  • Previous by thread: Re: convert int to NSString (Newbie)
  • Next by thread: Re: convert int to NSString (Newbie)
  • Index(es):
    • Date
    • Thread