Re: NSScanner troubles
Re: NSScanner troubles
- Subject: Re: NSScanner troubles
- From: Greg Parker <email@hidden>
- Date: Fri, 10 Dec 2010 19:25:57 -0800
On Dec 10, 2010, at 7:06 PM, WT wrote:
> I wrote some code to parse doubles from strings in a locale (pt_BR) where the grouping and decimal separators are "." and "," respectively (the exact opposite of en_US). It should be a piece of cake, but I'm not getting the correct results. Can someone please tell me what obvious fact I'm missing? I've been staring at this code for a while now and can't figure out what's wrong.
NSScanner -scanDouble: rejects the grouping separator in every locale. It assumes numbers are written without the grouping separator.
NSScanner does recognize the localized decimal separator. en_US "12345.6" and pt_BR "12345,6" should do what you want.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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