private string getSubStr(string sourceStr, int len)
{
string temp = sourceStr;
if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "aa", RegexOptions.IgnoreCase).Length <= len)
{
return temp;
}
for (int i = temp.Length; i >= 0; i--)
{
temp = temp.Substring(0, i);
if (Regex.Replace(temp, "[\u4e00-\u9fa5]", "aa", RegexOptions.IgnoreCase).Length <= len)
{
return temp;
}
}
return "";
}
浙公网安备 33010602011771号