Skip to content

Andrew-M-C/go.emoji

Repository files navigation

Build codecov Go Report Card codebeat badge

GoDoc EmojiVer License

This Package emoji is designed to recognize and parse every individual Unicode Emoji characters from a string.

Example

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->