/// <summary>
/// 取字符串的前len个字符,len以中文字符宽度为单位
/// </summary>
/// <param name="str"></param>
/// <param name="len"></param>
/// <returns></returns>
public static string strLen(string str,int len){
string strNew = "";
int strLen=0;
for(int i=0;i<str.Length;i++){
if((int)str[i]>255)
{
strLen += 2;
strNew += str[i].ToString();
}
else
{
strLen += 1;
strNew += str[i].ToString();
}
if(strLen >= len * 2)
return strNew + "...";
}
return strNew;
}