Issue #4780 has been updated by Yui NARUSE.

Status changed from Open to Assigned
Assignee set to Yukihiro Matsumoto


----------------------------------------
Feature #4780: String#split with a block
http://redmine.ruby-lang.org/issues/4780

Author: Joey Zhou
Status: Assigned
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: 
Target version: 


Mentioned before, in another (rejected) issue thread: http://redmine.ruby-lang.org/issues/4615

There are a few methods, which return an array without a trailing block, or also can be iterated with a block.

Such as String#scan.

String#split has only one form:

str.split(pattern=$;, limit=0) -> array

Maybe add a iterative form, when with a block:

str.split(pattern=$;, limit=0) {|field| ... } -> str

If the string is very long, and I only need to play with the splitted string one by one, this will not create a useless expensive array.

Joey


-- 
http://redmine.ruby-lang.org