Project

General

Profile

Actions

Feature #3575

closed

String#split is inconsistent with empty string and negative limit

Added by Conrad.Irwin (Conrad Irwin) over 14 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
[ruby-core:31296]

Description

Currently works like this:

"".split(",", -1) # => []

According to the documentation, blank fields should not be stripped when a negative offset is provided. I expect:

"".split(",", -1) # => [""]

Related issues 2 (0 open2 closed)

Related to Ruby master - Feature #4335: String#split for empty string is always empty arrayRejectedActions
Related to Ruby master - Feature #5120: String#split needs to be logicalRejectedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0