Re: NSFormatter troubles (was: NSScanner troubles)
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