摘要:
方法一:publicstaticstring 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;}方法二publicstaticstring stringformat(string str,int n) { /// ///格式化字符串长度,超出部分显示 阅读全文