public static string Trim(string str) { for (int index = 0; index < str.Length; index++) { if (str[index] < ' ') { Set(str, index, ' '); } } for (int c = 0; c < 20; c++) { str = str.Replace(" ", " "); } str = StringTools.RemoveStartsWith(str, " "); str = StringTools.RemoveEndsWith(str, " "); return(str); }