On 11/12/2010, at 3:54 PM, Ken Thomases wrote:

> On Dec 10, 2010, at 9:38 PM, WT wrote:
> 
>> thank you both for the very fast response.
> 
> You're welcome.
> 
>> Is that behavior of NSScanner documented anywhere? I read the docs but don't 
>> remember coming across it. I'm a bit stunned. What's the point of having a 
>> scanner if it ignores certain key aspects of the locale?
> 
> It's not ignoring the locale.  There are just different ways of formatting 
> numbers, and NSScanner just wasn't designed to understand some of them.  
> Group separators are more relevant to human-readable numbers than 
> computer-readable ones.
> 
> I would venture to say that NSScanner is an object-oriented analog to the 
> scanf family of functions from the standard C library.  Those do not 
> understand group separators, either.  It's pretty much the norm for 
> number-scanning library routines.  It's also the norm for library routines to 
> not include group separators when formatting numbers for output.  (e.g. 
> -[NSNumber stringValue])
> 
> Regards,
> Ken

Hi,

sorry if I'm way off the mark here, but wouldn't the best thing to use be 
NSScanner *scanner = [NSScanner localizedScannerWithString:[sender 
stringValue]];?  Then you don't have to worry about the specifics of number 
formatting in various locales.  Please let me know if I've missed the point.

Ron


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to