ruby-changes:23225
From: drbrain <ko1@a...>
Date: Tue, 10 Apr 2012 09:57:48 +0900 (JST)
Subject: [ruby-changes:23225] drbrain:r35275 (trunk): * string.c (rb_str_split_m): Documented behavior of split on the empty
drbrain 2012-04-10 09:57:40 +0900 (Tue, 10 Apr 2012) New Revision: 35275 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35275 Log: * string.c (rb_str_split_m): Documented behavior of split on the empty string. [ruby-trunk - Feature #3575] Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35274) +++ ChangeLog (revision 35275) @@ -1,3 +1,8 @@ +Tue Apr 10 09:57:00 2012 Eric Hodel <drbrain@s...> + + * string.c (rb_str_split_m): Documented behavior of split on the empty + string. [ruby-trunk - Feature #3575] + Tue Apr 10 09:48:31 2012 Eric Hodel <drbrain@s...> * ext/zlib/zlib.c (rb_deflate_s_deflate): Fixed ruby example replacing Index: string.c =================================================================== --- string.c (revision 35274) +++ string.c (revision 35275) @@ -5742,6 +5742,9 @@ * 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 @@ * "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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/