diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2022-03-16 14:45:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-16 14:45:48 -0500 |
commit | 59a1a8185fb15a8aa727eae1c55ee7a7b6366daf (patch) | |
tree | 2a2868a48cb96632b1f241f4ce1c0109144c4250 /string.c | |
parent | f38dcc78c4302bc7d5059d540507396bd9ea930e (diff) | |
download | ruby-59a1a8185fb15a8aa727eae1c55ee7a7b6366daf.tar.gz |
[DOC] Enhanced RDoc for String#split (#5644)
* Enhanced RDoc for String#split
* Enhanced RDoc for String#split
* Enhanced RDoc for String#split
* Enhanced RDoc for String#split
* Enhanced RDoc for String#split
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 53 |
1 files changed, 1 insertions, 52 deletions
@@ -8583,58 +8583,7 @@ literal_split_pattern(VALUE spat, split_type_t default_type) } /* - * call-seq: - * str.split(pattern=nil, [limit]) -> an_array - * str.split(pattern=nil, [limit]) {|sub| block } -> str - * - * Divides <i>str</i> into substrings based on a delimiter, returning an array - * of these substrings. - * - * If <i>pattern</i> is a String, then its contents are used as - * the delimiter when splitting <i>str</i>. If <i>pattern</i> is a single - * space, <i>str</i> is split on whitespace, with leading and trailing - * whitespace and runs of contiguous whitespace characters ignored. - * - * If <i>pattern</i> is a Regexp, <i>str</i> is divided where the - * pattern matches. Whenever the pattern matches a zero-length string, - * <i>str</i> is split into individual characters. If <i>pattern</i> contains - * groups, the respective matches will be returned in the array as well. - * - * If <i>pattern</i> is <code>nil</code>, the value of <code>$;</code> is used. - * If <code>$;</code> is <code>nil</code> (which is the default), <i>str</i> is - * 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 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. - * - * 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"] - * "1, 2.34,56, 7".split(%r{,\s*}) #=> ["1", "2.34", "56", "7"] - * "hello".split(//) #=> ["h", "e", "l", "l", "o"] - * "hello".split(//, 3) #=> ["h", "e", "llo"] - * "hi mom".split(%r{\s*}) #=> ["h", "i", "m", "o", "m"] - * - * "mellow yellow".split("ello") #=> ["m", "w y", "w"] - * "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", "", ""] - * - * "1:2:3".split(/(:)()()/, 2) #=> ["1", ":", "", "", "2:3"] - * - * "".split(',', -1) #=> [] - * - * If a block is given, invoke the block with each split substring. - * + * String#split is documented at doc/string.rdoc. */ static VALUE |