summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 14:46:09 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 14:46:09 +0000
commit1032750aa6fb528694508dcd0533b40e9ad805cf (patch)
tree74a02d2ca960456f47aeb82856d8485593644560 /string.c
parent5a7efe4dbf22dee4b5b105154294bc21be63a517 (diff)
merges r23930 from trunk into ruby_1_9_1.
-- * hash.c (rb_hash_hash): documentation fix. a patch from Marc-Andre Lafortune. [ruby-core:23943] * object.c (rb_mod_cmp): ditto. * range.c (range_eq): ditto. * string.c (rb_str_partition, rb_str_rpartition): ditto. * struct.c (rb_struct_s_def): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/string.c b/string.c
index 5440e37388..bf719b8eeb 100644
--- a/string.c
+++ b/string.c
@@ -6624,13 +6624,16 @@ rb_str_center(int argc, VALUE *argv, VALUE str)
/*
* call-seq:
* str.partition(sep) => [head, sep, tail]
- *
- * Searches the string for <i>sep</i> and returns the part before
- * it, the <i>sep</i>, and the part after it. If <i>sep</i> is not found,
- * returns <i>str</i> and two empty strings.
- *
+ * str.partition(regexp) => [head, match, tail]
+ *
+ * Searches <i>sep</i> or pattern (<i>regexp</i>) in the string
+ * and returns the part before it, the match, and the part
+ * after it.
+ * If it is not found, returns two empty strings and <i>str</i>.
+ *
* "hello".partition("l") #=> ["he", "l", "lo"]
* "hello".partition("x") #=> ["hello", "", ""]
+ * "hello".partition(/.l/) #=> ["h", "el", "lo"]
*/
static VALUE
@@ -6670,15 +6673,17 @@ rb_str_partition(VALUE str, VALUE sep)
/*
* call-seq:
- * str.rpartition(sep) => [head, sep, tail]
- *
- * Searches <i>sep</i> in the string from the end of the string, and
- * returns the part before it, the <i>sep</i>, and the part after it.
- * If <i>sep</i> is not found, returns two empty strings and
- * <i>str</i>.
- *
+ * str.rpartition(sep) => [head, sep, tail]
+ * str.rpartition(regexp) => [head, match, tail]
+ *
+ * Searches <i>sep</i> or pattern (<i>regexp</i>) in the string from the end
+ * of the string, and returns the part before it, the match, and the part
+ * after it.
+ * If it is not found, returns two empty strings and <i>str</i>.
+ *
* "hello".rpartition("l") #=> ["hel", "l", "o"]
* "hello".rpartition("x") #=> ["", "", "hello"]
+ * "hello".rpartition(/.l/) #=> ["he", "ll", "o"]
*/
static VALUE