import "github.com/hackebrot/turtle"
Package turtle is a library for working with emojis. The API ca be used to retrieve emoji for a specific name, a category or a keyword. You can also search emojis if you do not know the name of an emoji.
doc.go emojis.go filters.go turtle.go
const Version = "v0.1.0"
Version of the turtle library
Emojis maps a name to an Emoji
Category filters the emojis by a category
Example for using the Category function to find all emojis of the specified category.
Code:
c := "travel_and_places" emojis := Category(c) if emojis == nil { fmt.Fprintf(os.Stderr, "no emojis found for category: %v\n", c) os.Exit(1) } fmt.Printf("%s: %s\n", c, emojis[:3])
Output:
travel_and_places: [🚡 ✈️ 🚑]
Keyword filters the emojis by a keyword
Example for using the Keyword function to find all emojis with the specified keyword.
Code:
k := "happy" emojis := Keyword(k) if emojis == nil { fmt.Fprintf(os.Stderr, "no emoji found for keyword: %v\n", k) os.Exit(1) } fmt.Printf("%s: %s", k, emojis[:4])
Output:
happy: [😊 😁 😀 😂]
Search emojis by a name
Example for using the Search function to find all emojis with a name that contains the search string.
Code:
s := "computer" emojis := Search(s) if emojis == nil { fmt.Fprintf(os.Stderr, "no emojis found for search: %v\n", s) os.Exit(1) } fmt.Printf("%s: %s", s, emojis)
Output:
computer: [💻 🖱 🖥]
type Emoji struct { Name string `json:"name" toml:"name"` Category string `json:"category" toml:"category"` Char string `json:"char" toml:"char"` Keywords []string `json:"keywords" toml:"keywords"` }
Emoji holds info about an emoji character
String implementation for Emoji
Package turtle imports 1 packages (graph) and is imported by 2 packages. Updated 2017-10-12. Refresh now. Tools for package owners.