A small, fast Go library that removes emoji from UTF-8 text. It supports Unicode 17.0 and uses roughly 1 KiB of static lookup tables.
package main
import (
"fmt"
"github.com/levmv/emoji"
)
func main() {
text := "I love coding! 🚀💻"
result := emoji.Remove([]byte(text))
fmt.Println(string(result)) // I love coding!
}- Time complexity: O(n).
- Static lookup tables: roughly 1 KiB.
- If no emoji is found,
Removereturns the original slice without allocating. - UTF-8 is parsed directly without converting the input to runes.
- Input must be valid UTF-8. Skipping validation keeps the hot path small and fast.
- The text characters
©,®, and™are retained. Their optional U+FE0F emoji presentation selector is removed.
To update the generated data and lookup tables, run go generate ./....