B2X (Binary to Hexadecimal)

 ───B2X(binary_string)──────

Converts binary_string, a string of binary (0 or 1) digits, to an equivalent string of hexadecimal characters. You can optionally include blanks in binary_string (at four-digit boundaries only, not leading or trailing) to aid readability; they are ignored.

The returned string uses uppercase letters for the values A-F, and does not include blanks.

binary_string can be of any length; if it is the null string, then a null string is returned. If the number of binary digits in the string is not a multiple of four, then up to three 0 digits will be added on the left before the conversion to make a total that is a multiple of four.

Here are some examples:

B2X('11000011')    ==   'C3'
B2X('10111')       ==   '17'
B2X('101')         ==   '5'
B2X('1 1111 0000') ==   '1F0'

B2X( ) can be combined with the functions X2D( ) and X2C( ) to convert a binary number into other forms. For example:

X2D(B2X('10111'))  ==   '23'   /* decimal 23 */


[Back: BITXOR]
[Next: CENTER/CENTRE]