String#rindex should no longer take integer argument

parent 418eec2c
...@@ -1725,16 +1725,6 @@ mrb_str_rindex_m(mrb_state *mrb, mrb_value str) ...@@ -1725,16 +1725,6 @@ mrb_str_rindex_m(mrb_state *mrb, mrb_value str)
mrb_regexp_check(mrb, sub); mrb_regexp_check(mrb, sub);
switch (mrb_type(sub)) { switch (mrb_type(sub)) {
case MRB_TT_FIXNUM: {
mrb_int c = mrb_fixnum(sub);
unsigned char *p = (unsigned char*)RSTRING_PTR(str);
for (pos=len-1;pos>=0;pos--) {
if (p[pos] == c) return mrb_fixnum_value(pos);
}
return mrb_nil_value();
}
default: { default: {
mrb_value tmp; mrb_value tmp;
......
...@@ -424,9 +424,6 @@ assert('String#rindex', '15.2.10.5.31') do ...@@ -424,9 +424,6 @@ assert('String#rindex', '15.2.10.5.31') do
assert_nil 'abc'.rindex('d') assert_nil 'abc'.rindex('d')
assert_equal 0, 'abcabc'.rindex('a', 1) assert_equal 0, 'abcabc'.rindex('a', 1)
assert_equal 3, 'abcabc'.rindex('a', 4) assert_equal 3, 'abcabc'.rindex('a', 4)
assert_equal 3, 'abcabc'.rindex(97)
assert_equal nil, 'abcabc'.rindex(0)
end end
# 'String#scan', '15.2.10.5.32' will be tested in mrbgems. # 'String#scan', '15.2.10.5.32' will be tested in mrbgems.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment