mailio_ascii (mailio v0.2.0)

Byte-safe ASCII helpers (pure, total).

The string module interprets its input as Unicode and raises on invalid UTF-8. Header bytes and MIME tokens arrive as arbitrary bytes (real-world and adversarial mail is frequently not valid UTF-8), so the parser uses these byte-level helpers instead. They only touch the ASCII range and pass all other bytes through untouched.

Summary

Functions

Parse a leading signed integer from a (possibly non-UTF8) binary. Returns Default if no digits are present. Never raises.

Functions

lower(Bin)

-spec lower(binary()) -> binary().

to_integer(Bin, Default)

-spec to_integer(binary(), Default) -> integer() | Default.

Parse a leading signed integer from a (possibly non-UTF8) binary. Returns Default if no digits are present. Never raises.

trim(Bin)

-spec trim(binary()) -> binary().

trim_leading(Bin)

-spec trim_leading(binary()) -> binary().

trim_trailing(Bin)

-spec trim_trailing(binary()) -> binary().

upper(Bin)

-spec upper(binary()) -> binary().