Skip to content

Instantly share code, notes, and snippets.



Created Jul 23, 2019
What would you like to do?
Determine if a Character is an emoji, in Swift
extension Character {
var isEmoji: Bool {
return Character(UnicodeScalar(UInt32(0x1d000))!) <= self && self <= Character(UnicodeScalar(UInt32(0x1f77f))!)
|| Character(UnicodeScalar(UInt32(0x2100))!) <= self && self <= Character(UnicodeScalar(UInt32(0x26ff))!)

This comment has been minimized.

Copy link
Owner Author

@eneko eneko commented Jul 23, 2019

Found this code online a long time ago, not sure where, probably Stack Overflow :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment