using System.Collections.Generic;
public static void Main()
List<string> companies = new List<string>() {
"ABF FREIGHT SYSTEM INC",
"FEDEX FREIGHT PRIORITY",
"CORNERSTONE SYSTEMS INC",
"XPO LOGISTICS FREIGHT INC (LTL FREIGHT ONLY)"
foreach (var c in companies)
string validName = c.Length > 22 ? c.Substring(0, 22) : c;
Console.WriteLine(string.Format("{0} is written to the file as: {1}", c, validName));