Documentation ¶
Overview ¶
Package variationselector provides utility functions for adding and removing emoji variation selectors (16) that matches the suggestions in the Matrix spec.
Index ¶
Examples ¶
Constants ¶
View Source
const VS16 = "\ufe0f"
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add adds emoji variation selectors to all emojis that have multiple forms in the given string.
This will remove all variation selectors first to make sure it doesn't add duplicates.
Example ¶
package main import ( "fmt" "strconv" "maunium.net/go/mautrix/util/variationselector" ) func main() { fmt.Println(strconv.QuoteToASCII(variationselector.Add("\U0001f44d"))) // thumbs up (needs selector) fmt.Println(strconv.QuoteToASCII(variationselector.Add("\U0001f44d\ufe0f"))) // thumbs up with variation selector (stays as-is) fmt.Println(strconv.QuoteToASCII(variationselector.Add("\U0001f44d\U0001F3FD"))) // thumbs up with skin tone (shouldn't get selector) fmt.Println(strconv.QuoteToASCII(variationselector.Add("\U0001f914"))) // thinking face (shouldn't get selector) }
Output: "\U0001f44d\ufe0f" "\U0001f44d\ufe0f" "\U0001f44d\U0001f3fd" "\U0001f914"
func Remove ¶
Remove removes all emoji variation selectors in the given string.
Example ¶
package main import ( "fmt" "strconv" "maunium.net/go/mautrix/util/variationselector" ) func main() { fmt.Println(strconv.QuoteToASCII(variationselector.Remove("\U0001f44d"))) fmt.Println(strconv.QuoteToASCII(variationselector.Remove("\U0001f44d\ufe0f"))) }
Output: "\U0001f44d" "\U0001f44d"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.