[前][次][番号順一覧][スレッド一覧]

ruby-changes:14574

From: naruse <ko1@a...>
Date: Tue, 26 Jan 2010 02:28:10 +0900 (JST)
Subject: [ruby-changes:14574] Ruby:r26413 (ruby_1_8): * string.c (rb_str_split): add rdoc.

naruse	2010-01-26 02:27:50 +0900 (Tue, 26 Jan 2010)

  New Revision: 26413

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26413

  Log:
    * string.c (rb_str_split): add rdoc.
     patched by Hugh Sasse [ruby-core:27819]

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/string.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 26412)
+++ ruby_1_8/ChangeLog	(revision 26413)
@@ -1,3 +1,8 @@
+Tue Jan 26 02:25:46 2010  NARUSE, Yui  <naruse@r...>
+
+	* string.c (rb_str_split): add rdoc.
+	  patched by Hugh Sasse [ruby-core:27819]
+
 Mon Jan 25 23:24:26 2010  NARUSE, Yui  <naruse@r...>
 
 	* test/ruby/test_string.rb (test_split): add tests.
Index: ruby_1_8/string.c
===================================================================
--- ruby_1_8/string.c	(revision 26412)
+++ ruby_1_8/string.c	(revision 26413)
@@ -3614,7 +3614,9 @@
  *
  *  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 @@
  *     " 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"]

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]