I am working in an application in which i need to look up emoji characters from the string means a string contains one or more emojis ? As i am new in swift so i am not aware about it.
exa. "Newbie " will returns yes and "Newbie" will returns no
I am working in an application in which i need to look up emoji characters from the string means a string contains one or more emojis ? As i am new in swift so i am not aware about it.
exa. "Newbie " will returns yes and "Newbie" will returns no
Yes please use below method to identify emojies
public var checkcontainEmoji: Bool
{
for ucode in unicodeScalars
{
switch ucode.value
{
case 0x3030, 0x00AE, 0x00A9,
0x1D000...0x1F77F,
0x2100...0x27BF,
0xFE00...0xFE0F,
0x1F900...0x1F9FF:
return true
default:
continue
}
}
return false
}
Output : - "HI ".checkcontainEmoji --> TRUE