struct Int32

Defined in:

int32.cr

Class Method Summary

Instance Method Summary

Class Method Detail

def self.from_digits(digits : Array(Int32)) #

[View source]

Instance Method Detail

def digits #
Description copied from struct Int

Returns the digits of a number in a given base. The digits are returned as an array with the least significant digit as the first array element.

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

-12345.digits(7) # => ArgumentError

[View source]