Skip to content

Repository files navigation

emoji remover

Go Go Report Card

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.

Basic usage

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

Performance

  • Time complexity: O(n).
  • Static lookup tables: roughly 1 KiB.
  • If no emoji is found, Remove returns the original slice without allocating.
  • UTF-8 is parsed directly without converting the input to runes.

Important considerations

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

Updating Unicode data

To update the generated data and lookup tables, run go generate ./....

About

Fast and efficient emoji removal

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages