Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. static List<string> SplitString(int chunk, string input)
  2. {
  3. List<string> list = new List<string>();
  4. int cycles = input.Length / chunk;
  5.  
  6. if (input.Length % chunk != 0)
  7. cycles++;
  8.  
  9. for (int i = 0; i < cycles; i++)
  10. {
  11. try
  12. {
  13. if ((i + 1) * chunk < input.Length)
  14. list.Add(input.Substring(i * chunk, chunk));
  15. else
  16. list.Add(input.Substring(i * chunk));
  17. }
  18. catch
  19. {
  20.  
  21. }
  22. }
  23. return list;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement