using System.Collections.Generic;
public static class StringExtensions
public static IEnumerable<string> SplitInParts(this string s, int partLength)
if (s == null) throw new ArgumentNullException("s");
if (partLength <= 0) throw new ArgumentException("Part length has to be positive.", "partLength");
return s.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).GroupBy(w => (charCount += w.Length + 1) / partLength).Select(g => string.Join(" ", g));
public static void Main()
string input = "This is a very long string that will be split into many parts because its lenght exceed a certain amount of characters!";
var parts = input.SplitInParts(50);
foreach(var part in parts)