Ucwidth.CombinedEmoji (Catalyst v1.0.0-beta.2)

Copy Markdown View Source

A module for detecting combined Emoji graphemes.

Combined Emoji graphemes are combined from codepoints with one or more ZWJ (Zero Width Joinner).

Resources

Summary

Functions

Retrieve next combined Emoji grapheme from the beginning of a string, also returning rest of the string.

Functions

next_combined_emoji(string)

@spec next_combined_emoji(String.t()) :: :none | {String.t(), String.t()}

Retrieve next combined Emoji grapheme from the beginning of a string, also returning rest of the string.

Examples

The Emoji woman scientist 👩‍🔬 is a combined character, its codepoints are:

["👩", ZWJ, "🔬"], so it can be detected as:

iex> next_combined_emoji("👩‍🔬 -> woman scientist")
{"👩‍🔬", " -> woman scientist"}

If no combined Emoji character detected at the beginning, :none will be returned:

iex> next_combined_emoji("👨 :)")
:none

Please note normal Emoji characters detecting is out of the scope.