Method: String#oct
- Defined in:
- string.c
#oct ⇒ Integer
Treats leading characters of str as a string of octal digits (with an optional sign) and returns the corresponding number. Returns 0 if the conversion fails.
"123".oct #=> 83
"-377".oct #=> -255
"bad".oct #=> 0
"0377bad".oct #=> 255
4460 4461 4462 |
# File 'string.c', line 4460 static VALUE rb_str_oct(str) VALUE str; |