Skip to content

Instantly share code, notes, and snippets.

@arman-hpp
Created May 10, 2017 17:09
Show Gist options
  • Save arman-hpp/a1e8aa1090a86fe6dcc0559d25223534 to your computer and use it in GitHub Desktop.
Save arman-hpp/a1e8aa1090a86fe6dcc0559d25223534 to your computer and use it in GitHub Desktop.
Split By Iteration
List<string> Split(string str, int iterateCount)
{
var words = new List<string>();
for (int i = 0; i < str.Length; i += iterateCount)
if (str.Length - i >= iterateCount)
words.Add(str.Substring(i, iterateCount));
else
words.Add(str.Substring(i, str.Length - i));
return words;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment