summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-21 16:02:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-03-21 16:02:26 +0000
commit7506fde3e911100ccca169eff3a5f4916e8ed1da (patch)
tree8676822255eab5e5adec6ed37bc4c6d7e7ba18b9 /string.c
parenteb02dd3c05dea96a968fb18ecaed624e603e6790 (diff)
Improve documentation for 'text '.split
The documentation didn't mention trailing spaces and the example only demonstrated the case with leading spaces. [Fix GH-1845] From: Rodrigo Rosenfeld Rosas <rr.rosas@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/string.c b/string.c
index ebac5e043d..0ab2012c89 100644
--- a/string.c
+++ b/string.c
@@ -7641,8 +7641,8 @@ split_string(VALUE result, VALUE str, long beg, long len, long empty_count)
*
* If <i>pattern</i> is a <code>String</code>, 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 whitespace and runs
- * of contiguous whitespace characters ignored.
+ * 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 <code>Regexp</code>, <i>str</i> is divided where the
* pattern matches. Whenever the pattern matches a zero-length string,
@@ -7665,8 +7665,8 @@ split_string(VALUE result, VALUE str, long beg, long len, long empty_count)
* 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"]
+ * " 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"]