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# 截取过长中英文混合标题
精选 转载demon2012d 博主文章分类:ASP.NET
文章标签 C# 截取过长中英文混合标题 文章分类 .Net 后端开发
上一篇:C# 转换人民币大小金额
下一篇:C# 保存远程文件到本地
-
c#中英文混合字符串截取指定长度
c#中英文混合字符串截取指定长度
c#中英文混合字符串截取指定长度