Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDecimalSeparator localization II



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: NSDecimalSeparator localization II (From: Mark Dawson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.