Re: NSDecimalSeparator localization II
Re: NSDecimalSeparator localization II
- Subject: Re: NSDecimalSeparator localization II
- From: "Sean McBride" <email@hidden>
- Date: Thu, 30 Dec 2004 13:54:13 -0500
Mark Dawson (email@hidden) on Thu, Dec 30, 2004 01:02 PM said:
> unsigned int len = [aString length];
> if (len <= 2) // can't have trailing zero's with a string length of 2
>or less
> return;
What about a string like ".0"? A degenerate example I know. :)
> if (!(c >= '1' && c <= '9'))
Not all languages use the characters 0 to 9. Happily, there is
[NSCharacterSet decimalDigitCharacterSet] and NSString's
stringByTrimmingCharactersInSet, which you can use together to do this
more nicely.
You can also use the above to check if NSDecimalSeparator has any numbers
in it, then maybe just don't touch the string at all.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Mac Software Designer 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