Method: String#slice
- Defined in:
- string.c
#[](index) ⇒ nil #[](start, length) ⇒ nil #[](range) ⇒ nil #[](regexp, capture = 0) ⇒ nil #[](substring) ⇒ nil
Returns the substring of self specified by the arguments. See examples at String Slices.
5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 |
# File 'string.c', line 5684 static VALUE rb_str_aref_m(int argc, VALUE *argv, VALUE str) { if (argc == 2) { if (RB_TYPE_P(argv[0], T_REGEXP)) { return rb_str_subpat(str, argv[0], argv[1]); } else { return rb_str_substr_two_fixnums(str, argv[0], argv[1], TRUE); } } rb_check_arity(argc, 1, 2); return rb_str_aref(str, argv[0]); } |