summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-06 06:07:05 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-06 06:07:05 +0000
commitca3c007f058f17b2f0bf3c5ccc6701f3f6d49ca5 (patch)
tree17dfac498404a28791a9b28b018421980bffcafe /string.c
parent3b9c00306f7213c2ac779f13845e04d29827cc06 (diff)
* string.c (rb_str_match_m): add description about optional
position parameter. [ruby-list:47064] patched by KISHIMOTO, Makoto <ksmakoto AT dd.iij4u.or.jp> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/string.c b/string.c
index caca178fc4..ca27db6963 100644
--- a/string.c
+++ b/string.c
@@ -2555,12 +2555,15 @@ static VALUE get_pat(VALUE, int);
/*
* call-seq:
- * str.match(pattern) => matchdata or nil
+ * str.match(pattern) => matchdata or nil
+ * str.match(pattern, pos) => matchdata or nil
*
* Converts <i>pattern</i> to a <code>Regexp</code> (if it isn't already one),
* then invokes its <code>match</code> method on <i>str</i>. If the second
* parameter is present, it specifies the position in the string to begin the
* search.
+ * If the second parameter is present, it specifies the position in the string
+ * to begin the search.
*
* 'hello'.match('(.)\1') #=> #<MatchData "ll" 1:"l">
* 'hello'.match('(.)\1')[0] #=> "ll"
@@ -2586,7 +2589,7 @@ rb_str_match_m(int argc, VALUE *argv, VALUE str)
{
VALUE re, result;
if (argc < 1)
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1)", argc);
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
re = argv[0];
argv[0] = str;
result = rb_funcall2(get_pat(re, 0), rb_intern("match"), argc, argv);