• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSScanner troubles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSScanner troubles
      • From: WT <email@hidden>
References: 
 >NSScanner troubles (From: WT <email@hidden>)

  • Prev by Date: NSScanner troubles
  • Next by Date: Re: NSScanner troubles
  • Previous by thread: NSScanner troubles
  • Next by thread: Re: NSScanner troubles
  • Index(es):
    • Date
    • Thread