Pattern match on any single UTF-8 character
You can do this with:
def char?(<<c::utf8>>), do: true
def char?(_), do: false
Note that this only matches a binary with a single character, to match on the next character in a string, you can just do:
def char?(<<c::utf8, _rest::binary>>), do: true