method

digits

Importance_1
v2_4_6 - Show latest stable - 0 notes - Class: Integer
digits(*args) public

Returns the array including the digits extracted by place-value notation with radix base of int.

base should be greater than or equal to 2.

12345.digits      #=> [5, 4, 3, 2, 1]
12345.digits(7)   #=> [4, 6, 6, 0, 5]
12345.digits(100) #=> [45, 23, 1]

-12345.digits(7)  #=> Math::DomainError
Show source
Register or log in to add new notes.