BASE

The BASE function converts a Number to a String with the given radix.

Declaration

BASE(number, radix, min_length) -> string

Parameters

number (required, type: number)

The decimal number to be converted to radix.

radix (required, type: number)

The radix or base the number should be converted to.

min_length (optional, type: number)

The minimum length the String should be. If the converted number contains less than min_length digits, it will be prefixed with zeros making the final string min_length long.

Return Values

string (type: number)

The converted number as a string

Examples

In addition to the normal digits zero through nine, the base 16 number system also represents digits with the characters 'a', 'b', 'c', 'd', 'e', and 'f'. A rather famous hexadecimal number in computer science is the number 3735928559.

BASE(3735928559, 16) -> "deadbeef"

We could prefix eight zeros by specifying that the string should be no less than sixteen digits long.

BASE(3735928559, 16, 16) -> "00000000deadbeef"

Last updated