I've been working on this iOS app recently and I encountered a (rather easily solved) problem: How do I determine if my string is comprised only of emojis?
Well, that's your job today!
A string. If the presence of unicode characters is problematic for you then you may use a different reasonable format. Please state what you do if you do something different from a regular string for taking input.
Print or return a truthy value if the input string contains only emojis, and a falsey value if it contains any characters other than emojis.
Wait a sec... what's an emoji? 😅
An emoji is a character that falls in these ranges:
0x1F600...0x1F64F // Emoticons 0x1F300...0x1F5FF // Misc Symbols and Pictographs 0x1F680...0x1F6FF // Transport and Map 0x2600...0x26FF // Misc symbols 0x2700...0x27BF // Dingbats 0xFE00...0xFE0F // Variation Selectors
This is 🔹code-golf🔹, so shortest code in bytes wins❕
"Is it an emoji? 🤔" -> False "🔹code-golf🔹" -> False "😮 😥 😨 😩 😪" -> False "I have no fancy emojis :(" -> False "😎" -> True "😊😘" -> True
For you poor souls who cannot see emojis, here is an image of the test cases.