Re: convert int to NSString (Newbie)
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