Advertisement
Dojnaz

Emojify

Oct 27th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace Emojify
  17. {
  18.     /// <summary>
  19.     /// Interaction logic for MainWindow.xaml
  20.     /// </summary>
  21.     public partial class MainWindow : Window
  22.     {
  23.         public MainWindow()
  24.         {
  25.             InitializeComponent();
  26.         }
  27.  
  28.         private void Input_TextChanged(object sender, TextChangedEventArgs e)
  29.         {
  30.             try
  31.             {
  32.                 bool looping = true;
  33.  
  34.                 string outputText = " ";
  35.                 if (Input.Text == "") { goto End; }
  36.                 String inputString = Input.Text;
  37.                 char[] inputArray = inputString.ToCharArray();
  38.                 int i = inputArray.Length;
  39.                 while (looping)
  40.                 {
  41.                     loop:
  42.                     i--;
  43.                     if (i <= 0) { looping = false; }
  44.                     inputArray[i] = char.ToLower(inputArray[i]);
  45.                     string currentChar = Convert.ToString(inputArray[i]);
  46.                     if (currentChar == " ") { outputText = "   " + outputText; goto loop; }
  47.                     if ((inputArray[i] >= 'a' && inputArray[i] <= 'z') || (inputArray[i] >= 'A' && inputArray[i] <= 'Z'))
  48.                     {
  49.                         outputText = ":regional_indicator_" + inputArray[i] + ": " + outputText;
  50.                     } else
  51.                     {
  52.                         outputText = inputArray[i] + " " + outputText;
  53.                     }
  54.                 }
  55.                 End:
  56.                 Output.Text = outputText;
  57.             } catch { /* Don't care */ }
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement