Functions to introspect the Link_Email property for binaries (Strings) and codepoints.
Link_Email is the set of characters valid in the local part of an email address — the portion before the @ — as defined by UTS #58.
Unlike the enumerated properties this is binary: a codepoint is either in the set or it is not. It therefore does not implement Unicode.Property.Behaviour, which assumes a map of values to ranges, and the primary API is the predicate link_email?/1.
Summary
Functions
Returns the count of codepoints valid in an email local part.
Returns whether a codepoint or every codepoint of a string is valid in an email local part.
Returns the codepoint ranges of the Link_Email property.
Functions
Returns the count of codepoints valid in an email local part.
Returns
- A non-negative integer count.
Examples
iex> Unicode.LinkEmail.count() > 100_000
true
Returns whether a codepoint or every codepoint of a string is valid in an email local part.
Arguments
string_or_codepointis either a binary (String) or a codepoint in the range0..0x10FFFF.
Returns
For a codepoint,
trueorfalse.For a binary,
trueonly when every codepoint is valid, so the result can be used directly to validate a candidate local part. An empty string returnstrue, since it has no invalid codepoint; callers needing a non-empty local part should check that separately.
Examples
iex> Unicode.LinkEmail.link_email?(?a)
true
iex> Unicode.LinkEmail.link_email?(?@)
false
iex> Unicode.LinkEmail.link_email?("first.last")
true
iex> Unicode.LinkEmail.link_email?("has space")
false
Returns the codepoint ranges of the Link_Email property.
Returns
- A list of codepoint ranges as 2-tuples.
Examples
iex> Unicode.LinkEmail.ranges() |> is_list()
true