A swift 4.0 String extension class to handle Emoji related tasks.
pod 'StringEmoji', :git => 'https://github.com/piterwilson/StringEmoji.git'
import StringEmoji
Character set containing all known emoji (as described in official Unicode List 5.0 http://unicode.org/emoji/charts-5.0/emoji-list.html)
Whether or not the String
instance represents a known single Emoji character
print("".isEmoji) // false
print("๐".isEmoji) // true
print("๐๐".isEmoji) // false (String is not a single Emoji)
Whether or not the String
instance contains a known Emoji character
print("".containsEmoji) // false
print("๐".containsEmoji) // true
print("๐๐".containsEmoji) // true
Applies a kCFStringTransformToUnicodeName
- CFStringTransform
on a copy of the String
print("รก".unicodeName) // \N{LATIN SMALL LETTER A WITH ACUTE}
print("๐".unicodeName) // \N{FACE WITH STUCK-OUT TONGUE AND WINKING EYE}
Returns the result of a kCFStringTransformToUnicodeName
- CFStringTransform
with \N{
prefixes and }
suffixes removed
print("รก".unicodeName) // LATIN SMALL LETTER A WITH ACUTE}
print("๐".unicodeName) // FACE WITH STUCK-OUT TONGUE AND WINKING EYE
Whether or not the Character
instance represents a known Emoji character
print("".isEmoji) // false
print("๐".isEmoji) // true