Bitstring Functions
Version dev
Version:
FunctionDescriptionExampleResultAliases

bit_position(substring, bitstring)

Returns first starting index of the specified substring within bits, or zero if it is not present. The first (leftmost) bit is indexed 1

bit_position('010'::BIT, '1110101'::BIT)

4

bitstring(bitstring, length)

Pads the bitstring until the specified length

bitstring('1010'::BIT, 7)

0001010

get_bit(bitstring, index)

Extracts the nth bit from bitstring; the first (leftmost) bit is indexed 0

get_bit('0110010'::BIT, 2)

1

set_bit(bitstring, index, new_value)

Sets the nth bit in bitstring to newvalue; the first (leftmost) bit is indexed 0. Returns a new bitstring

set_bit('0110010'::BIT, 2, 0)

0100010

Search Shortcut cmd + k | ctrl + k