From: D T Date: 2003-06-26T23:57:04+09:00 Subject: Re: String#split(' ') and whitespace (perl user's surprise) --0-477693412-1056639421=:61925 Content-Type: text/plain; charset=us-ascii 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 "] Dave --------------------------------- Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! --0-477693412-1056639421=:61925 Content-Type: text/html; charset=us-ascii
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 "]
 
Dave
 


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month! --0-477693412-1056639421=:61925--