Project

General

Profile

Feature #4780

String#split with a block

Added by Joey Zhou about 5 years ago. Updated over 3 years ago.

Status:
Assigned
Priority:
Normal
[ruby-core:36466]

Description

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


Related issues

Related to Ruby trunk - Feature #4615: Add IO#split and iterative form of String#split Rejected 04/26/2011

History

#1 [ruby-core:36510] Updated by Yui NARUSE about 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to Yukihiro Matsumoto

#2 [ruby-core:49149] Updated by Yusuke Endoh over 3 years ago

  • Target version set to next minor

Also available in: Atom PDF