Project

General

Profile

Actions

Feature #4780

closed

String#split with a block

Added by yimutang (Joey Zhou) almost 14 years ago. Updated almost 7 years ago.

Status:
Closed
Target version:
-
[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 1 (0 open1 closed)

Related to Ruby master - Feature #4615: Add IO#split and iterative form of String#splitRejectedmatz (Yukihiro Matsumoto)04/26/2011Actions

Updated by naruse (Yui NARUSE) almost 14 years ago

  • Status changed from Open to Assigned
  • Assignee set to matz (Yukihiro Matsumoto)

Updated by mame (Yusuke Endoh) over 12 years ago

  • Target version set to 2.6
Actions #3

Updated by naruse (Yui NARUSE) about 7 years ago

  • Target version deleted (2.6)
Actions #5

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • Description updated (diff)
Actions #6

Updated by nobu (Nobuyoshi Nakada) almost 7 years ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r62763.


string.c: split with block

  • string.c (rb_str_split_m): yield each split substrings if the
    block is given, instead of returing the array. [Feature #4780]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy