about me
Google_search
hot
latest
photos
links
按字符串实际长度截取定长字符窜
来源:来自网络 作者:不详 日期:2008-03-05 热度:///
/// 按字符串实际长度截取定长字符窜
///
/// 原字符串
/// 要截取的长度
/// string型字符串
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;
}
↑ 返回顶部
Tags: 按字符串实际长度截取定长字符窜
广告位招租,广告代号:gg468
↑ 返回顶部
search
advertise




![还你真实的开幕式!震撼美图[转]【连载】](/up_files/image/Article/2008/08/12/57015031.jpg)



