On Sat, May 1, 2010 at 1:10 PM, Henrik Sperre Johansen <henrik.s.johansen@veloxit.no> wrote:
��On 01.05.2010 10:51, laurent laffont wrote:
In Pharo:

':' split: 'one:two:three:' �� => OrderedCollection( 'one' 'two' 'three' '' )
(':' split: 'one:two:three:') size => 4

Last element is an empty String

In Ruby:

>> 'one:two:three:'.split(':')
=> ["one", "two", "three"]
>> 'one:two:three:'.split(':').size
=> 3

Laurent Laffont
Well, technically speaking you could say it is correct.
Does Ruby drop all empty subsequences?
ie:
('.' split: 'hah...hah') size gives 4 or 2?

It seems it drops only the last ones:

>> 'hah...hah'.split('.')
=> ["hah", "", "", "hah"]

>>��'.hah...hah'.split('.')
=> ["", "hah", "", "", "hah"]

>> 'hah...hah.'.split('.')
=> ["hah", "", "", "hah"]

>> 'hah...hah..'.split('.')
=> ["hah", "", "", "hah"]
��
Laurent Laffont





��

Personally I'm more annoyed that:
(#great split: #(bad great bad great bad great bad)) size = 1, but:
(#(great) split: #(bad great bad great bad great bad)) size = 4

Cheers,
Henry


_______________________________________________
Pharo-project mailing list
Pharo-project@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project