1 /// <summary> 2 /// 截断字符串 3 /// </summary> 4 /// <param name="s">要截断的字符串</param> 5 /// <param name="len">要保留的字符长度</param> 6 /// <returns>截断后的字符串</returns> 7 public static string Format(string s, int len) 8 { 9 if (s.Length > len) 10 s = s.Substring(0, len) + "..."; 11 return s; 12 }