elephant v0.1.0 Elephant.Message View Source

Link to this section Summary

Functions

Splits a string into two at the first zero-byte

Removes CR / CRLF at the beginning of the string

Link to this section Functions

Link to this function normalize_headers(headers) View Source

Splits a string into two at the first zero-byte.

Examples

iex> Elephant.Message.read_until_zero(<<65, 66, 0, 67, 68>>)
{"AB", "CD"}

iex> Elephant.Message.read_until_zero(<<65, 66, 0>>)
{"AB", ""}

iex> Elephant.Message.read_until_zero(<<0, 67, 68>>)
{"", "CD"}

iex> Elephant.Message.read_until_zero(<<65, 66>>)
{"AB", ""}

Removes CR / CRLF at the beginning of the string.

Examples

iex> Elephant.Message.skip_newlines("\n\n\nHello")
"Hello"

iex> Elephant.Message.skip_newlines("Hello")
"Hello"

iex> Elephant.Message.skip_newlines("\r\n\r\nHello")
"Hello"