public static IEnumerable<string> SplitBySize(this string str, int chunkSize) { if (chunkSize < 1) throw new ArgumentException("Split size cannot be less then 1", "chunkSize"); return Enumerable.Range(0, (int)Math.Ceiling(str.Length / (double)chunkSize)).Select(i => str.Substring(i * chunkSize, chunkSize)); }