ruby-changes:47288
From: nagachika <ko1@a...>
Date: Sun, 23 Jul 2017 16:48:37 +0900 (JST)
Subject: [ruby-changes:47288] nagachika:r59403 (ruby_2_4): merge revision(s) 59002: [Backport #13621]
nagachika 2017-07-23 16:48:31 +0900 (Sun, 23 Jul 2017) New Revision: 59403 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59403 Log: merge revision(s) 59002: [Backport #13621] string.c: docs for String#split * string.c: [DOC] clarify docs for String#split when called with limit and capture groups. Reported by Cichol Tsai. [ruby-core:81505] [Bug #13621] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/string.c branches/ruby_2_4/version.h Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59402) +++ ruby_2_4/version.h (revision 59403) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-07-23" -#define RUBY_PATCHLEVEL 154 +#define RUBY_PATCHLEVEL 155 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 7 Index: ruby_2_4/string.c =================================================================== --- ruby_2_4/string.c (revision 59402) +++ ruby_2_4/string.c (revision 59403) @@ -7188,7 +7188,7 @@ static const char isspacetable[256] = { https://github.com/ruby/ruby/blob/trunk/ruby_2_4/string.c#L7188 /* * call-seq: - * str.split(pattern=nil, [limit]) -> anArray + * str.split(pattern=nil, [limit]) -> an_array * * Divides <i>str</i> into substrings based on a delimiter, returning an array * of these substrings. @@ -7208,9 +7208,11 @@ static const char isspacetable[256] = { https://github.com/ruby/ruby/blob/trunk/ruby_2_4/string.c#L7208 * split on whitespace as if ' ' were specified. * * If the <i>limit</i> parameter is omitted, trailing null fields are - * suppressed. If <i>limit</i> is a positive number, at most that number of - * fields will be returned (if <i>limit</i> is <code>1</code>, the entire - * string is returned as the only entry in an array). If negative, there is no + * suppressed. If <i>limit</i> is a positive number, at most that number + * of split substrings will be returned (captured groups will be returned + * as well, but are not counted towards the limit). + * If <i>limit</i> is <code>1</code>, the entire + * string is returned as the only entry in an array. If negative, there is no * limit to the number of fields returned, and trailing null fields are not * suppressed. * @@ -7230,6 +7232,8 @@ static const char isspacetable[256] = { https://github.com/ruby/ruby/blob/trunk/ruby_2_4/string.c#L7232 * "1,2,,3,4,,".split(',', 4) #=> ["1", "2", "", "3,4,,"] * "1,2,,3,4,,".split(',', -4) #=> ["1", "2", "", "3", "4", "", ""] * + * "1:2:3".split(/(:)()()/, 2) #=> ["1", ":", "", "", "2:3"] + * * "".split(',', -1) #=> [] */ Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59402) +++ ruby_2_4 (revision 59403) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59002 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/