Maybe a basic question but let us say I have a string that is 2000 characters long, I need to split this string into max 512 character chunks each.
Is there a nice way,
static IEnumerable Split(string str, int chunkSize) { int len = str.Length; return Enumerable.Range(0, len / chunkSize).Select(i => str.Substring(i * chunkSize, chunkSize)); }
source: Splitting a string into chunks of a certain size