svetlozar_kirkov

String to Unicode (Exercise)

Oct 10th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleTests
  6. {
  7.     class ConsoleTests
  8.     {
  9.         static void Main()
  10.         {
  11.             string input = Console.ReadLine();
  12.             StringBuilder result = new StringBuilder();
  13.             foreach (var character in input)
  14.             {
  15.                 int temp = Convert.ToInt32(character);
  16.                
  17.                     result.Append(String.Format("\\u{0:x4} ", temp).Trim());
  18.             }
  19.             Console.WriteLine(result);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment