NetBlog主题

 C#截取字符串按字节截取SubString
C#类库与方法

C#截取字符串按字节截取SubString

5414

public static string CutByteString(string str,int len){string result=string.Empty;// 最终返回的结果if(string.IsNullOrEmpty(str)) { return result; }int byteLen=System.Text.Encoding.Default.GetByteCount(str);// 单字节字符长度int charLen=str.Length;// 把字符平…