I’ve just published the first version of ex_cldr_unicode that might be helpful to you. It builds functions at compile time using data from the Unicode database.
Theres a bunch of fun stuff you can do, but to your use case it includes some guards that you may find useful. For example:
defmodule MyModule do
require Cldr.Unicode.Guards
alias Cldr.Unicode.Guards
def my_function(codepoint) when Guards.is_upper(codepoint) do
IO.puts "Its Uppercase!"
end
See hex docs for further info.
I’ve defined only the following guards so far but it’s trivial to add more so let me know if its useful:
is_upperis_loweris_digitis_currency_symbol
Oh, and it’s more than twice as fast as using a regex for this kind of matching.
There are a bunch of classifier functions as well. From my understanding of your use case the following may also apply:
iex> Cldr.Unicode.Property.alphanumeric? "1234"
true
iex> Cldr.Unicode.Property.alphanumeric? "KeyserSöze1995"
true
iex> Cldr.Unicode.Property.alphanumeric? "3段"
true
iex> Cldr.Unicode.Property.alphanumeric? "dragon@example.com"
false


















