using System.Collections.Generic;
public static void Main()
string input = @"Text strings are used in many different ways. A text string is enclosed in double quotes, and can contain any combination of letters, numbers, spaces, and punctuation.";
List<string> split = new List<string>();
split = LinesSplit(input, 35);
foreach (string line in split)
public static List<string> LinesSplit(string stringToSplit, int maxLineLength)
List<string> lines = new List<string>();
string[] words = stringToSplit.Trim().Split(' ');
string line = String.Empty;
string word = String.Empty;
string remain = String.Empty;
string last = words[words.Length - 1];
for (int index = 0; index < words.Length; index++)
if (String.IsNullOrEmpty(remain) == false)
line = $"{line} {remain}".Trim();
if ((line.Length + word.Length) >= maxLineLength)
line = $"{line} {word}".Trim();
line = $"{line} {remain}".Trim();