Here's something I needed. It's probably useless to most people. Convert positive base10 integers.
PHP Code:
function ConvertBase(target, base) {
if (base == 1 || base == 0) return 0;
temp.basestring = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
while (target > 0) {
temp.newstring @= temp.basestring.charat(target % base);
target = int(target/base);
}
for (temp.i = temp.newstring.length(); temp.i >= 0; temp.i --) temp.output @= temp.newstring.substring(temp.i, 1);
return temp.output;
}
Example of usage:
ConvertBase(5544, 2) converts the number 5544 to binary, 1010110101000.
ConvertBase(5544, 16) converts the number 5544 to base 16, 15A8.
ConvertBase(5544, 36) converts the number 5544 to base 36, 4A0.
Have fun.