Represent number in different numeral systems
Use method Fixnum#to_s
with radix (between 2 and 36) as parameter.
Examples:
1234567890.to_s(2) #=> "1001001100101100000001011010010"
1234567890.to_s(8) #=> "11145401322"
1234567890.to_s(16) #=> "499602d2"
1234567890.to_s(36) #=> "kf12oi"
Written by Alex Sulim
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#