Search code examples
c#unicodeemoji

Translate string to emoji in c#


How to turn such a string into an emoji? 1F600 => 😀 or 1F600 => \U0001F600 or 1F600 => 0x1F600

I spent a few days but I still didn't understand how to translate a string like 1F600 into emoji


Solution

  • You simply need to convert the value to the code point then get the character at that code point:

    var emoji = Char.ConvertFromUtf32(Convert.ToInt32("1F600", 16));
    

    Demo on dotnetfiddle