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 21:58:27 -0200
On Dec 11, 2010, at 9:42 PM, Stephen J. Butler wrote:
> On Sat, Dec 11, 2010 at 5:37 PM, WT <email@hidden> wrote:
>> thanks for replying. I tried it and it gives the exact same results as before, that is, the presence of the group separator causes the number formatter to return nil. Besides, there remains the date formatter issue.
>
> Forgive me for using FScript, but I find it easier to prototype these
> kinds of Cocoa problems:
>
>> l := NSLocale alloc initWithLocaleIdentifier:'pt_BR'
>
>> nf := NSNumberFormatter alloc init
>
>> nf setLocale:l
>
>> nf setUsesGroupingSeparator:YES
>
>> nf numberFromString:'1.111,20'
> 1111.2
>
>> df := NSDateFormatter alloc init
>
>> df setLocale:l
>
>> df setDateStyle:NSDateFormatterShortStyle
>
>> df dateFromString:'23/04/2010'
> 2010-04-23 00:00:00 -0500
>
>
> Works for me!
I'll have to look up about FScript since I didn't know about it. Anyway, using setDateStyle:NSDateFormatterShortStyle works, though it still doesn't make sense to me that I should set a particular style for reading in data when I can't be sure what format the data is going to be provided to me now or in the future. However, setUsesGroupingSeparator:YES still has no effect for me.
May I send you (off-list) the test project?
Thanks again.
WT_______________________________________________
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