1
0
Fork 0
mirror of https://github.com/emojisum/emojisum.git synced 2025-08-03 13:50:27 +00:00

list: link unicode codepoint the full list

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2017-11-17 11:26:04 -05:00
parent 85d3b16c68
commit 043174f418
Signed by: vbatts
GPG key ID: 10937E57733F1362
3 changed files with 122 additions and 102 deletions

View file

@ -1,6 +1,9 @@
package emoji
import "strings"
import (
"fmt"
"strings"
)
// Map returns the emoji at the provided position.
// This list is from 0-255
@ -37,3 +40,14 @@ func IsColonNotation(word string) bool {
func IsCodepoint(word string) bool {
return strings.HasPrefix(strings.ToUpper(word), "U+")
}
var unicodeURL = `http://www.unicode.org/emoji/charts/full-emoji-list.html`
// UnicodeLink returns a link to unicode.org list for CodePoint, or just the
// full list if not a codepoint
func UnicodeLink(word string) string {
if !IsCodepoint(word) {
return unicodeURL
}
return fmt.Sprintf("%s#%s", unicodeURL, strings.SplitN(strings.ToLower(word), "+", 2)[1])
}