fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string[,] table3x3 = new string[3, 3];
  8. string myString = "11A23A4A5A87A5";
  9. string[] splitA = myString.Split(new char[] { 'A' });
  10.  
  11. int index = 0;
  12. bool first = true;
  13. foreach (string part in splitA)
  14. {
  15. int row = index / 3;
  16. int col = index % 3;
  17.  
  18. if (!first)
  19. {
  20. table3x3[row, col] = part[0].ToString();
  21. }
  22.  
  23. index += part.Length;
  24. first = false;
  25. }
  26.  
  27. for (int row = 0; row < 3; row ++)
  28. {
  29. for (int col = 0; col < 3; col++)
  30. if (string.IsNullOrEmpty(table3x3[row,col]))
  31. Console.Write("[ ]");
  32. else
  33. Console.Write("["+table3x3[row,col]+"]");
  34. Console.WriteLine();
  35. }
  36. }
  37. }
Success #stdin #stdout 0.03s 37880KB
stdin
Standard input is empty
stdout
[ ][ ][2]
[ ][4][5]
[8][ ][5]