Created
June 28, 2013 05:47
-
-
Save aaronpearce/5882713 to your computer and use it in GitHub Desktop.
Just a small script to help me convert between base10 and base36 as needed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
toValue = ARGV[0].to_i | |
idValue = ARGV[1] | |
if(!toValue || !idValue) | |
puts "You must supply your base-N number, either 10 or 36 and the value to be converted!\nExample: baseChange 36 2410189243882429" | |
else | |
if(toValue === 10) | |
puts idValue.to_i(36) | |
else | |
puts idValue.to_i.to_s(36) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment