Developer postOriginal post (opens in a new tab)

Version 0.6B - Base Conversion

The latest update adds the BASECONVERT subroutine.

BASECONVERT converts a value from any base to any other base.

For example, to convert a hexadecimal value (base 16) to a decimal value (base 10):

VAR="FF"
SOURCE=16
TARGET=10
BASECONVERT

RESULT will now contain the value "255" after the conversion.

BASECONVERT supports base 2 (binary) through base 36.

Here's an example of converting a binary value of 1001 to decimal:

VAR="1001"
SOURCE=2
TARGET=10
BASECONVERT

RESULT will now contain the value "9" after the conversion.

The reverse is also true. You can convert 9 into its binary form:

VAR=9
SOURCE=10
TARGET=2
BASECONVERT

RESULT will now contain "1001" after the conversion.

If you converted a value back to decimal (base 10), it will be stored as a string. To convert the string back to an integer value:

TEXT="5005"
STRINGVALUE

RESULT now contains the integer 5005 instead of a string containing "5005" as its value.

You can also convert an entire array of data to its value equivalent:

ARRAY=MYARRAY
ARRAYVALUE

Assuming MYARRAY contained strings such as "10" or "5.5" then the array will contain values such as 10 (integer) or 5.5 (floating point) after the conversion.

Have fun!