This Package emoji
is designed to recognize and parse every individual Unicode Emoji characters from a string.
func main() {
s := "๐ฉโ๐ฉโ๐ฆ๐จ๐ณ"
i := 0
final := emoji.ReplaceAllEmojiFunc(s, func(emoji string) string {
i++
fmt.Printf("%02d - %s - UTF-8 len %d\n", i, emoji, len(emoji))
return fmt.Sprintf("%d-", i)
})
fmt.Printf("final: <%s>\n", final)
}
// Output:
// 01 - ๐ฉโ๐ฉโ๐ฆ - UTF-8 len 18
// 02 - ๐จ๐ณ - UTF-8 len 8
// final: <1-2->