fork download
  1. using System;
  2. using System.Collections.Generic;
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. String[] arrayString = new string[]{"","","","",""};
  8. List<string[]> splitted = new List<string[]>();//This list will contain all the splitted arrays.
  9. int lengthToSplit = 3;
  10.  
  11. int arrayLength = arrayString.Length;
  12.  
  13. for (int i = 0; i < arrayLength; i = i + lengthToSplit)
  14. {
  15. string[] val = new string[lengthToSplit];
  16.  
  17. if (arrayLength < i + lengthToSplit)
  18. {
  19. lengthToSplit = arrayLength - i;
  20. }
  21. Array.Copy(arrayString, i, val, 0, lengthToSplit);
  22. splitted.Add(val);
  23. }
  24. }
  25. }
Success #stdin #stdout 0.01s 13988KB
stdin
Standard input is empty
stdout
Standard output is empty