Andrew-M-C / go.emoji

Golang emoji parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Golang emoji parser

License:Other


Languages

Language:Go 100.0%