summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-10 00:57:40 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-10 00:57:40 +0000
commite5c418d9910b3170ca13aee161ac6b08e9ae3a0c (patch)
tree0e11cc29cb9eb9e489a7f239b8a7e47a40a760ba /string.c
parent830ff445f9728c1d4aa50ef4a44a34427e8bfa7a (diff)
* string.c (rb_str_split_m): Documented behavior of split on the empty
string. [ruby-trunk - Feature #3575] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/string.c b/string.c
index 079891a04a..79de311358 100644
--- a/string.c
+++ b/string.c
@@ -5742,6 +5742,9 @@ static const char isspacetable[256] = {
* limit to the number of fields returned, and trailing null fields are not
* suppressed.
*
+ * When the input +str+ is empty an empty Array is returned as the string is
+ * considered to have no fields to split.
+ *
* " now's the time".split #=> ["now's", "the", "time"]
* " now's the time".split(' ') #=> ["now's", "the", "time"]
* " now's the time".split(/ /) #=> ["", "now's", "", "the", "time"]
@@ -5754,6 +5757,8 @@ static const char isspacetable[256] = {
* "1,2,,3,4,,".split(',') #=> ["1", "2", "", "3", "4"]
* "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"]
* "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""]
+ *
+ * "".split(',', -1) #=> []
*/
static VALUE