Re: NSScanner troubles
Re: NSScanner troubles
- Subject: Re: NSScanner troubles
- From: Ken Thomases <email@hidden>
- Date: Fri, 10 Dec 2010 22:54:43 -0600
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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden