Advertisement
FrayxRulez

Untitled

Oct 6th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.         public static string GetUriForEmoji(string glyphs)
  2.         {
  3.             var result = string.Empty;
  4.             var i = 0;
  5.  
  6.             do
  7.             {
  8.                 if (char.IsSurrogatePair(glyphs, i))
  9.                 {
  10.                     result += char.ConvertToUtf32(glyphs, i).ToString("x2");
  11.                     i += 2;
  12.                 }
  13.                 else
  14.                 {
  15.                     result += ((short)glyphs[i]).ToString("x4");
  16.                     i++;
  17.                 }
  18.  
  19.                 if (i < glyphs.Length)
  20.                     result += "-";
  21.  
  22.             } while (i < glyphs.Length);
  23.  
  24.             return $"ms-appx:///Assets/Emoji/Sprites/{result}.png";
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement