From: nahi <nakahiro@...>
Date: 2012-03-18T19:04:25+09:00
Subject: [ruby-core:43437] [ruby-trunk - Feature #4335][Rejected] String#split for empty string is always empty array


Issue #4335 has been updated by nahi.

Description updated
Status changed from Feedback to Rejected

It's intended feature, and -1 is prepared for your purpose as Nobu said. #3575
----------------------------------------
Feature #4335: String#split for empty string is always empty array
https://bugs.ruby-lang.org/issues/4335#change-24904

Author: phasis68
Status: Rejected
Priority: Normal
Assignee: 
Category: core
Target version: 2.0.0


=begin
 Here is ruby's behavior:
 
 C:\work>irb
 irb(main):001:0> ' '.split('/')
 => [" "]
 irb(main):002:0> ''.split('/')
 => []
 irb(main):003:0> '/'.split('/')
 => []
 
 Here is python's behavior:
 Python 2.4.3 (#1, Jun 11 2009, 14:09:37)
 [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> ' '.split('/')
 [' ']
 >>> ''.split('/')
 ['']
 >>> '/'.split('/')
 ['', '']
 
 Is there any chance of ''.split('/') returns [''] instead of []?
=end



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