diff options
| author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-25 17:27:50 +0000 |
|---|---|---|
| committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-25 17:27:50 +0000 |
| commit | 185ed6e270577f38132e4a559249c32591314bcd (patch) | |
| tree | 943ab0119c9d62b965140d902e43246d90004dd6 | |
| parent | 456385357465032b64252023b1dc13f59d599b11 (diff) | |
* string.c (rb_str_split): add rdoc.
patched by Hugh Sasse [ruby-core:27819]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | string.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Tue Jan 26 02:25:46 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * string.c (rb_str_split): add rdoc. + patched by Hugh Sasse [ruby-core:27819] + Mon Jan 25 23:24:26 2010 NARUSE, Yui <naruse@ruby-lang.org> * test/ruby/test_string.rb (test_split): add tests. @@ -3614,7 +3614,9 @@ rb_str_count(argc, argv, str) * * 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, - * <i>str</i> is split into individual characters. + * <i>str</i> is split into individual characters. If + * <i>pattern</i> includes one or more capturing subpatterns, + * these will be returned in the array returned by split. * * If <i>pattern</i> is omitted, the value of <code>$;</code> is used. If * <code>$;</code> is <code>nil</code> (which is the default), <i>str</i> is @@ -3631,6 +3633,8 @@ rb_str_count(argc, argv, str) * " 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"] + * "1, 2.34,56".split(%r{(,\s*)}) #=> ["1", ", ", "2.34", ",", "56"] + * "wd :sp: wd".split(/(:(\w+):)/) #=> ["wd ", ":sp:", "sp", " wd"] * "hello".split(//) #=> ["h", "e", "l", "l", "o"] * "hello".split(//, 3) #=> ["h", "e", "llo"] * "hi mom".split(%r{\s*}) #=> ["h", "i", "m", "o", "m"] |
