eccan

Base 36

3 posts in this topic

Has anyone found a way to convert an integer to Base 36 (uses 0-9 & a-z to count)?  

Share this post


Link to post
Share on other sites

My first thought is "Why?", but that's just out of curiosity. I've never encountered a need for that. What are you doing that requires that conversion?

If you can write a routine to convert between binary and decimal, it should scale up to base x once you get the pattern figured out. If you need a tool to use manually, try this:
http://www.unitconversion.org/numbers/base-10-to-base-36-conversion.html

I remember doing manual base conversions a LONG time ago. There was a process where you'd calculate each digit by dividing or multiplying and carrying over the remainder. It was a little painful to do by hand but wouldn't be too awful to implement. I'd have to get my head back in that space to figure it out again, but that will have to wait.

Share this post


Link to post
Share on other sites

Using this on a machine making an automotive part for Bosch, and their serial number uses this format.  It allows them to use only 4 characters in their serial number to get over 1 million

unique numbers ( 36^4 ).  Found a formula to divide and use the remainder like you suggested, and it didn't take much to program.   Thanks for your help

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now