using System.Collections;
using System.Collections.Generic;
public static void Main()
var z = SplitWordChunks("testtesttest test", 10);
public static IEnumerable<string> SplitWordChunks(string text, int maxSize)
List<string> result = new List<string>();
string[] words = text.Split(' ');
string currentChunk = "";
for (int i = 0; i < words.Length;)
string currentWord = words[i];
if (currentChunk.Length + currentWord.Length <= maxSize - 1)
currentChunk += (currentChunk.Length > 0 ? " " : "") + currentWord;
if (currentChunk.Length < maxSize / 2 || currentWord.Length > maxSize)
currentChunk += (currentChunk.Length > 0 ? " " : "") + currentWord.Substring(0, maxSize - currentChunk.Length - 1);
words[i] = currentWord.Substring(maxSize - currentChunk.Length);
result.Add(currentChunk);
result.Add(currentChunk);