String#split is inconsistent with empty string and negative limit
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) # => [""]
Updated by drbrain (Eric Hodel) almost 10 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r35275.
Conrad, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- string.c (rb_str_split_m): Documented behavior of split on the empty string. [ruby-trunk - Feature #3575]