diff options
Diffstat (limited to 'string.c')
| -rw-r--r-- | string.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -6884,13 +6884,16 @@ rb_str_center(int argc, VALUE *argv, VALUE str) /* * call-seq: * str.partition(sep) => [head, sep, tail] + * str.partition(regexp) => [head, match, 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. + * 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 @@ -6930,15 +6933,17 @@ rb_str_partition(VALUE str, VALUE sep) /* * call-seq: - * str.rpartition(sep) => [head, sep, tail] + * str.rpartition(sep) => [head, sep, tail] + * str.rpartition(regexp) => [head, match, 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>. + * 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 |
