Here's an outline of a very plain one step-at-a-time solution:
List<string> chunks = new List<string>();
string mytext = "Quick brown fox jumps over the lazy dog yet we!";
int sLen = mytext.Length;
int chunkSize = 4;
int remainder = sLen % chunkSize;
string pad = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
for (int i = 0; i < sLen; i += chunkSize)
{
if(i + chunkSize <= sLen)
{
chunks.Add(mytext.Substring(i, chunkSize));
}
else
{
chunks.Add(mytext.Substring(i, remainder) + pad.Substring(0, chunkSize - remainder));
}
}
In this solution the case that the length of the data string is not evenly divisible by the chunk size is handled by padding the "remainder" characters in the last element in the List with tilde characters (~).