public static string GetSubString(string title, int length) { int totalLength = 0; int currentIndex = 0; while (totalLength < length && currentIndex < title.Length) { if (title[currentIndex] < 0 || title[currentIndex] > 255) totalLength += 2; else totalLength++; currentIndex++; } if (currentIndex < title.Length) return title.Substring(0, currentIndex) + "..."; else return title.ToString(); }
C# 截取过长中英文混合标题
最新推荐文章于 2018-11-12 18:16:12 发布