Advertisement
mellowdeep

ASCII table

Nov 3rd, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3.  
  4.  
  5. class PrintTheASCIITable
  6. {
  7.     static void Main()
  8.     {
  9.         Console.OutputEncoding = Encoding.Unicode;
  10.  
  11.         char symbol = '\u0127';
  12.         char[] asciiMissingChars = {'\u2022', '\u25D8', '\u25CB', '\u25D9'};
  13.         int row;
  14.                
  15.         Console.WriteLine("{0} = {1}", 0, "null");
  16.  
  17.         for (row = 1; row < 255; row++)
  18.         {
  19.             if (row > 6 && row < 11)
  20.             {
  21.                 for (int i = 0; i < asciiMissingChars.Length; i++)
  22.                 {
  23.                     Console.WriteLine("{0} = {1}", row, asciiMissingChars[i]);
  24.                     row++;
  25.                 }
  26.                 row = 10;
  27.             }
  28.             else if (row == 13)
  29.             {
  30.                 Console.WriteLine("{0} = {1}", row, '\u266A');
  31.             }
  32.             else if (row == 32)
  33.             {
  34.                 Console.WriteLine("{0} = {1}", row, "space");
  35.             }
  36.             else if (row > 127 && row < 161)
  37.             {
  38.                 Console.WriteLine("{0} = {1}", row, symbol);
  39.                 symbol++;
  40.             }
  41.             else if (row == 127)
  42.             {
  43.                 Console.WriteLine("{0} = {1}", row, '⌂');
  44.             }
  45.             else
  46.             {
  47.                 Console.WriteLine("{0} = {1}", row, (char)row);
  48.             }
  49.         }
  50.         Console.WriteLine("{0} = {1}", 255, "nbsp");
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement