BITMASKSTRING

BITMASKSTRING(array)[source]

Converts a boolean array into a compact hexadecimal mask string representation.

BITMASKSTRING encodes a BOOLEAN_ARRAY as a hexadecimal string, where each character represents 4 boolean values (bits). If the array length is not a multiple of 4, the last group is padded with zeros.

Parameters:

array (Operand) –

The boolean array to convert into a hexadecimal mask string.

Supported types:

  • BOOLEAN_ARRAY

Return type:

Formula

Returns:

A formula object that evaluates to a hexadecimal string representing the boolean array.

Characteristics:

  • Each character encodes 4 boolean values (0-9, A-F)

  • String length is ceil(array_length / 4)

Supported types:

  • STRING

Raises:

ValueError – If array is not a BOOLEAN_ARRAY

Examples

Basic 4-bit conversion:

BITMASKSTRING([True, False, True, False])
# Returns "0A"
# Explanation: Binary 1010 → Hex 0A

Fewer than 4 bits (padded with zeros):

BITMASKSTRING([True, True, True])
# Returns "0E"
# Explanation: Binary 1110 (last bit padded with 0) → Hex 0E