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     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to