[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zero padding numbers

From: leeg
Subject: Re: zero padding numbers
Date: Fri, 8 Dec 2006 04:26:50 -0800 (PST)
User-agent: SquirrelMail/1.4.6

>> On 18 Nov 2006, at 18:26, Graham J Lee wrote:
>> I've got a few hours tomorrow, I'd like to have some go at
>> implementing -stringForObjectValue:
> That took longer than I thought :-).  Just to make it look like there's
> still activity...I've done this now, I'm just going to do some tests and
> compare with the OS X version so I should be able to provide a patch later
> this week.

OK, here's the patch to NSNumberFormatter, as well as a patch on the
testsuite to verify that a variety of common use-cases work.  I also fixed
a problem with -attributedStringForObjectValue:withDefaultAttributes:
where it would return attributedStringForZero for any number x, |x|<0.5. 
I didn't put too much effort into checking whether -stringForObjectValue:
works with complex formatting strings, because as ratmice pointed out, on
Cocoa the various -setFormat: methods actually sanitise the format string
which -stringForObjectValue: actually sees.  So that still needs to be
done ;-)



P.S. I think it's possible to get away with using a lot fewer local
variables than I needed :-(

Attachment: nsnumberformatter-patch
Description: Binary data

Attachment: nsnumberformatter-testsuite-patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]