• 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: NSFormatter troubles (was: NSScanner troubles)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFormatter troubles (was: NSScanner troubles)


  • Subject: Re: NSFormatter troubles (was: NSScanner troubles)
  • From: WT <email@hidden>
  • Date: Sat, 11 Dec 2010 21:52:40 -0200

On Dec 11, 2010, at 9:38 PM, Stephen J. Butler wrote:

> On Sat, Dec 11, 2010 at 5:14 PM, WT <email@hidden> wrote:
>> All results are correct, except for the last two. "123.456,78" should result in 123456.78 and 23/04/2010 should result in the appropriate NSDate object for April 23, 2010.
>>
>> The locale is NOT being ignored, since 12,34 and 123456,78 are parsed correctly. Yet, the group separator causes trouble and dates aren't being parsed correctly.
>
> Also, -[NSDateFormatter setDateStyle:]. Try NSDateFormatterShortStyle.
> I got that from reading the Reminder example linked in the docs.

Ok, I think I'm misunderstanding something fundamental here.

My understanding is that setting a style is useful when you want to output a string from a given number or date, not when you want to read in a number or date from an input string. How would I know ahead of time what style the strings presented to me are going to be using? It doesn't make sense to me that I need to set the style to read the data.

So, is my understanding here flawed?_______________________________________________

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: NSFormatter troubles (was: NSScanner troubles)
      • From: Scott Ribe <email@hidden>
References: 
 >NSScanner troubles (From: WT <email@hidden>)
 >Re: NSScanner troubles (From: Greg Parker <email@hidden>)
 >Re: NSScanner troubles (From: WT <email@hidden>)
 >Re: NSScanner troubles (From: Ken Thomases <email@hidden>)
 >Re: NSScanner troubles (From: Ron Fleckner <email@hidden>)
 >Re: NSScanner troubles (From: WT <email@hidden>)
 >NSFormatter troubles (was: NSScanner troubles) (From: WT <email@hidden>)
 >Re: NSFormatter troubles (was: NSScanner troubles) (From: "Stephen J. Butler" <email@hidden>)

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