Hi all, I made a follow-up patch like discussed on the workshop. Now
porting becomes as easy as changing "asNumber" to "squeezeOutNumber".

Name: SLICE-issue-1258-squeezeOutNumber-NikoSchwarz.2


This slice adds squeezeNumberOutOfString: to Number, as discussed in
the Pharo workshop. On the way, it
fixes an issue in SqNumberParser, where it would return itself rather
than the result of the failblack, when
parsing fails.

Also, a test is added to test and document the new squeezing number
out of strings behavior.

Example usage:

        self assert: '123blabla' squeezeOutNumber equals: 123.
        self assert: 'blabla123' squeezeOutNumber equals: 123.
        self assert: 'blabla12blabla' squeezeOutNumber equals: 12.
        self assert: ('12.3bla' squeezeOutNumber -12.3 ) abs < 0.0001.
        self assert: '.1' squeezeOutNumber > 0.

Cheers,

Niko

On Tue, Oct 20, 2009 at 2:14 PM, Adrian Lienhard <[email protected]> wrote:
> 10492 (this is the stream of the branch 1.0rc1)
> -----
>
> - Issue 1320:   [squeak trunk] Sort the conflicts. This is required when
> merging a distant version, like Pharo for example...
> - Issue 1338:   HostWindowTests>>testOne is failing in Windows
> - Issue 1345:   Revert Number class>>readFrom: (was integrated with
> issue 1258)
>
> ___________________
> http://www.adrian-lienhard.ch/
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to