• 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 22:41:40 -0200

On Dec 11, 2010, at 10:31 PM, Scott Ribe wrote:

> On Dec 11, 2010, at 4:52 PM, WT wrote:
>
>> 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.
>
> Parsing of dates (& times) in Cocoa (& Core Foundation) is just plain lame. Your output format does totally affect what it can parse, and it provides no good way to just flexibly parse a date in any common format for the current locale.
>
> I learned this last week, while expunging a last little bit of deprecated code--the old International Utilities, which were in my opinion far superior for parsing dates & times.

I won't go so far as to claim that date and number parsing is lame, but it does seem reasonable to me that one should only need to set the locale and do nothing else. With the locale information, NSNumberFormatter, NSDateFormatter, and NSScanner should be able to parse any strings properly formatted according to the locale in question. Having to make extra assumptions seems to me to defeat the purpose of encapsulating locale information into an NSLocale object._______________________________________________

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

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>)
 >Re: NSFormatter troubles (was: NSScanner troubles) (From: WT <email@hidden>)
 >Re: NSFormatter troubles (was: NSScanner troubles) (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: NSFormatter troubles (was: NSScanner troubles)
  • Next by Date: Re: Getting current mouse position after scroll
  • Previous by thread: Re: NSFormatter troubles (was: NSScanner troubles)
  • Next by thread: Re: NSScanner troubles
  • Index(es):
    • Date
    • Thread