Hacker News new | ask | show | jobs
by favorited 996 days ago
Here's a 1-liner, producing the string "text 0123 漢字":

`String("text EMOJI 0123 漢字".unicodeScalars.filter({ !$0.properties.isEmojiPresentation }))`

(I've had to substitute EMOJI for a smiley face, because HN is bad at text encoding.)

2 comments

Thanks. Unfortunately both .isEmojiPresentation && .isEmoji leaves many emojis out, like red heart and many other.
Those aren't inherently emojis, the font just shows them as emojis, so you'd have to render the text.
Correct. `isEmojiPresentation` checks if, per the Unicode standard, this scalar should default to an emoji presentation.
It's not a bug, HN deliberately strips emojis.