Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Convert base N to base 10

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jan 2010 01:48 Edited at: 3rd Jan 2010 02:45
This will convert a number to base 10 (decimal) from any base 2 through 36.

Version 2
Now you can convert from base 10 as well.



If that's not enough and you need to convert a string into or from Base 64, then there's my other program here.


> SELECT * FROM users WHERE clue > 0
> 0 rows returned
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 3rd Jan 2010 13:36 Edited at: 3rd Jan 2010 13:37
Not bad, though converting to base-10 can be sped up a lot:



Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 12th Jan 2010 22:02
Phaelax: 0
Dark Coder: 1



Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Jan 2010 00:31 Edited at: 14th Jan 2010 00:31
If you leave in the call to upper$(), your array wouldn't need to store an extra 26 lower case letters.

@xeno, i get partial credit back now.


"Any sufficiently advanced technology is indistinguishable from magic" ~ Arthur C. Clarke

Login to post a reply

Server time is: 2024-05-03 23:21:52
Your offset time is: 2024-05-03 23:21:52