On Thursday 26 June 2003 8:57 am, D T wrote:
> Bug ? May-be / Maybe not ...
>
> Anyway, just let you know:
> (1) the split( /\s+/o, 3) does not work as we want.
> (2) you could use squeeze, but still have tailling problem ...
> (3) Ruby behaviour the way like that now... ( you may need do more
> work on the last item. )
>
> irb(main):001:0> '    A     50       3 for 130'.split(/\s+/o, 3)
> ["", "A", "50       3 for 130"]
> irb(main):002:0> '    A     50       3 for 130'.squeeze.split(' ', 3)
> ["A", "50", "3 for 130"]
> irb(main):003:0> '    A     50       3 for 130     '.squeeze.split('
> ', 3) ["A", "50", "3 for 130 "]

I think you want strip instead of squeeze:

irb(main):002:0> "   I    like   broccolli   ".squeeze
=> " I like brocoli "
irb(main):003:0> "   I    like   broccolli   ".strip
=> "I    like   broccolli"

I got those mixed up in a script once before and it took me forever to 
debug. ;)

-- 
Wesley J. Landaker - wjl / icecavern.net
OpenPGP FP: C99E DF40 54F6 B625 FD48  B509 A3DE 8D79 541F F830