摘要:
方法一:public static string GetString(string str, int length){int i = 0, j = 0;foreach(char chr in str){if((int)chr > 127){i += 2;}else{i ++;}if (i > length){str = str.Substring(0, j) + "...";break;}j ++;}return str;}方法二public static string stringformat(string str,int n){//////格式化字符串长度, 阅读全文