From 77fef79f107679eadb10cafb3ed22f6732825115 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 21 Sep 2006 01:10:25 +0000 Subject: [PATCH] * string.c (rb_str_partition): RDoc typo fixed. [ruby-core:08898] * string.c (rb_str_rpartition): fixed separation seek bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ string.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6028f3e354..bbaf80991f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 21 10:07:09 2006 Yukihiro Matsumoto + + * string.c (rb_str_partition): RDoc typo fixed. [ruby-core:08898] + + * string.c (rb_str_rpartition): fixed separation seek bug. + Thu Sep 21 09:38:12 2006 Yukihiro Matsumoto * string.c (rb_str_lines): new method to split a string into lines. diff --git a/string.c b/string.c index 1fd5a64b39..8390a969ed 100644 --- a/string.c +++ b/string.c @@ -4413,7 +4413,7 @@ rb_str_center(int argc, VALUE *argv, VALUE str) * returns str and two empty strings. * * "hello".partition("l") #=> ["he", "l", "lo"] - * "hello".partition("x") #=> ["helo", "", ""] + * "hello".partition("x") #=> ["hello", "", ""] */ static VALUE @@ -4462,8 +4462,8 @@ rb_str_partition(int argc, VALUE *argv, VALUE str) * If sep is not found, returns two empty strings and * str. * - * "hello".partition("l") #=> ["he", "l", "lo"] - * "hello".partition("x") #=> ["helo", "", ""] + * "hello".rpartition("l") #=> ["hel", "l", "o"] + * "hello".rpartition("x") #=> ["", "", "hello"] */ static VALUE @@ -4484,7 +4484,7 @@ rb_str_rpartition(VALUE str, VALUE sep) rb_raise(rb_eTypeError, "type mismatch: %s given", rb_obj_classname(sep)); } - pos = rb_str_index(str, sep, pos); + pos = rb_str_rindex(str, sep, pos); } if (pos < 0) { return rb_ary_new3(3, rb_str_new(0,0),rb_str_new(0,0), str);