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

ruby-changes:37054

From: ayumin <ko1@a...>
Date: Sun, 4 Jan 2015 12:37:22 +0900 (JST)
Subject: [ruby-changes:37054] ayumin:r49135 (trunk): * string.c: improve docs for String#strip and variations. [Bug #10476]

ayumin	2015-01-04 12:37:10 +0900 (Sun, 04 Jan 2015)

  New Revision: 49135

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

  Log:
    * string.c: improve docs for String#strip and variations. [ruby-core:66081][Bug #10476]

  Modified files:
    trunk/ChangeLog
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49134)
+++ ChangeLog	(revision 49135)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jan  4 12:24:11 2015  Ayumu AIZAWA  <ayumu.aizawa@g...>
+
+	* string.c: improve docs for String#strip and variations.
+	  [ruby-core:66081][Bug #10476]
+
 Sun Jan  4 09:21:04 2015  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* lib/drb/drb.rb: removed unused argument. Patch by @vipulnsward
Index: string.c
===================================================================
--- string.c	(revision 49134)
+++ string.c	(revision 49135)
@@ -7281,6 +7281,8 @@ lstrip_offset(VALUE str, const char *s, https://github.com/ruby/ruby/blob/trunk/string.c#L7281
  *  change was made. See also <code>String#rstrip!</code> and
  *  <code>String#strip!</code>.
  *
+ *  Refer to <code>strip</code> for the definition of whitespace.
+ *
  *     "  hello  ".lstrip   #=> "hello  "
  *     "hello".lstrip!      #=> nil
  */
@@ -7317,6 +7319,8 @@ rb_str_lstrip_bang(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L7319
  *  Returns a copy of <i>str</i> with leading whitespace removed. See also
  *  <code>String#rstrip</code> and <code>String#strip</code>.
  *
+ *  Refer to <code>strip</code> for the definition of whitespace.
+ *
  *     "  hello  ".lstrip   #=> "hello  "
  *     "hello".lstrip       #=> "hello"
  */
@@ -7366,6 +7370,8 @@ rstrip_offset(VALUE str, const char *s, https://github.com/ruby/ruby/blob/trunk/string.c#L7370
  *  no change was made. See also <code>String#lstrip!</code> and
  *  <code>String#strip!</code>.
  *
+ *  Refer to <code>strip</code> for the definition of whitespace.
+ *
  *     "  hello  ".rstrip   #=> "  hello"
  *     "hello".rstrip!      #=> nil
  */
@@ -7401,6 +7407,8 @@ rb_str_rstrip_bang(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L7407
  *  Returns a copy of <i>str</i> with trailing whitespace removed. See also
  *  <code>String#lstrip</code> and <code>String#strip</code>.
  *
+ *  Refer to <code>strip</code> for the definition of whitespace.
+ *
  *     "  hello  ".rstrip   #=> "  hello"
  *     "hello".rstrip       #=> "hello"
  */
@@ -7427,6 +7435,8 @@ rb_str_rstrip(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L7435
  *
  *  Removes leading and trailing whitespace from <i>str</i>. Returns
  *  <code>nil</code> if <i>str</i> was not altered.
+ *
+ *  Refer to <code>strip</code> for the definition of whitespace.
  */
 
 static VALUE
@@ -7464,8 +7474,12 @@ rb_str_strip_bang(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L7474
  *
  *  Returns a copy of <i>str</i> with leading and trailing whitespace removed.
  *
+ *  Whitespace is defined as any of the following characters:
+ *  null, horizontal tab, line feed, vertical tab, form feed, carriage return, space.
+ *
  *     "    hello    ".strip   #=> "hello"
  *     "\tgoodbye\r\n".strip   #=> "goodbye"
+ *     "\x00\t\n\v\f\r ".strip #=> ""
  */
 
 static VALUE

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

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