@@ -5,6 +5,52 @@ import (
5
5
"os"
6
6
)
7
7
8
+ // Example for using the Emojis map to find an
9
+ // emoji for the specified name.
10
+ func ExampleEmojis () {
11
+ name := "turtle"
12
+ emoji , ok := Emojis [name ]
13
+
14
+ if ! ok {
15
+ fmt .Fprintf (os .Stderr , "no emoji found for name: %v\n " , name )
16
+ os .Exit (1 )
17
+ }
18
+
19
+ fmt .Printf ("Name: %q\n " , emoji .Name )
20
+ fmt .Printf ("Char: %s\n " , emoji .Char )
21
+ fmt .Printf ("Category: %q\n " , emoji .Category )
22
+ fmt .Printf ("Keywords: %q\n " , emoji .Keywords )
23
+
24
+ // Output:
25
+ // Name: "turtle"
26
+ // Char: π’
27
+ // Category: "animals_and_nature"
28
+ // Keywords: ["animal" "slow" "nature" "tortoise"]
29
+ }
30
+
31
+ // Example for using the EmojisByChar map to find an
32
+ // emoji for the specified emoji character.
33
+ func ExampleEmojisByChar () {
34
+ char := "π’"
35
+ emoji , ok := EmojisByChar [char ]
36
+
37
+ if ! ok {
38
+ fmt .Fprintf (os .Stderr , "no emoji found for char: %v\n " , char )
39
+ os .Exit (1 )
40
+ }
41
+
42
+ fmt .Printf ("Name: %q\n " , emoji .Name )
43
+ fmt .Printf ("Char: %s\n " , emoji .Char )
44
+ fmt .Printf ("Category: %q\n " , emoji .Category )
45
+ fmt .Printf ("Keywords: %q\n " , emoji .Keywords )
46
+
47
+ // Output:
48
+ // Name: "turtle"
49
+ // Char: π’
50
+ // Category: "animals_and_nature"
51
+ // Keywords: ["animal" "slow" "nature" "tortoise"]
52
+ }
53
+
8
54
// Example for using the Category function to find all
9
55
// emojis of the specified category.
10
56
func ExampleCategory () {
0 commit comments