Converting from Base N to Base XBy Alex Morgan and Claude Rubinson
VBScript does not natively support Base N notation or calculations; nevertheless, since both SQL and COM objects support Base N, the ability to convert from decimal (Base 10) format to Base N (and vice versa) is sometimes necessary.
Three scripts are developed below. The first converts from Base N to decimal. The second, from decimal to Base N. The third utilizes the previous functions to permit conversion between any two bases (Base N to Base X).
There are a few issues to be aware of. First, the scripts are case-insensitive. Specifically, all lower-case characters are converted to upper-case before being processed. Second, the supplied value may be specified either as numeric or text (just be sure to include the quotes when specifying values as text!). Third, the
outBase must be specified as integers. Base A would be specified as 10; Base B, as 11; etc. Finally, the scripts have an upperbound limit of Base Z. Please note that we have not included error-trapping in these functions; you may wish to.