Make your own free website on
3.2.5. B2X(binstring)

Takes a parameter which is interpreted as a binary string, and
returns a hexadecimal string which represent the same information.
Binstring can only contain the binary digits 0 and 1.  To increase
readability, blanks may be included in binstring to group the
digits into groups. Each such group must have a multiple of four
binary digits, except from the first group. If the number of
binary digits in the first group is not a multiple of four, that
group is padded at the left with up to three leading zeros, to
make it a multiple of four. Blanks can only occur between binary
digits, not as leading or trailing characters.

Each group of four binary digits is translated into on hexadecimal
digit in the output string. There will be no extra blanks in the
result, and the upper six hexadecimal digits are in upper case.

     B2X(‘0010 01011100 0011’)     –>   ‘26C3’
     B2X(‘10 0101 11111111’)       –>   ‘26FF’
     B2X(‘0100100 0011’)      –>   ‘243’