View Source Wafer.Format (wafer v1.1.0)

Handy functions for formatting bytes, especially for debugging.

Summary

Functions

Convert the provided value into it's 0-padded byte-oriented string representation.

Convert the provided value into it's 0-padded byte-oriented string representation.

Functions

@spec to_bin(integer() | binary()) :: String.t()

Convert the provided value into it's 0-padded byte-oriented string representation.

Examples

iex> to_bin(0x1234)
"0b00010010_00110100"

iex> to_bin(<<0xF0, 0x0F>>)
"0b11110000_00001111"
@spec to_hex(integer() | binary()) :: String.t()

Convert the provided value into it's 0-padded byte-oriented string representation.

Examples

iex> to_hex(0x1234)
"0x1234"

iex> to_hex(<<0xF0, 0x0F>>)
"0xF00F"