View Source Md.Guards (md v0.9.1)

Several guards for the proper UTF8 handling of input.

examples

Examples

iex> import Md.Guards
iex> with <<x::utf8, _::binary>> <- " ", do: is_ascii_space(x)
true
iex> with <<x::utf8, _::binary>> <- " ", do: is_non_ascii_space(x)
false
iex> with <<x::utf8, _::binary>> <- " ", do: is_utf8_space(x)
true
iex> with <<x::utf8, _::binary>> <- "!", do: is_ascii_punct(x)
true
iex> with <<x::utf8, _::binary>> <- "!", do: is_non_ascii_punct(x)
false
iex> with <<x::utf8, _::binary>> <- "!", do: is_utf8_punct(x)
true
iex> with <<x::utf8, _::binary>> <- "1", do: is_ascii_digit(x)
true
iex> with <<x::utf8, _::binary>> <- "1", do: is_non_ascii_digit(x)
false
iex> with <<x::utf8,_::binary>> <- "①", do: is_utf8_digit(x)
true

Link to this section Summary

Link to this section Functions

Link to this macro

is_ascii_digit(char)

View Source (macro)
Link to this macro

is_ascii_punct(char)

View Source (macro)
Link to this macro

is_ascii_space(char)

View Source (macro)
Link to this macro

is_non_ascii_digit(char)

View Source (macro)
Link to this macro

is_non_ascii_punct(char)

View Source (macro)
Link to this macro

is_non_ascii_space(char)

View Source (macro)
Link to this macro

is_utf8_digit(char)

View Source (macro)
Link to this macro

is_utf8_punct(char)

View Source (macro)
Link to this macro

is_utf8_space(char)

View Source (macro)