日期:2014-05-18 浏览次数:20545 次
string str = "aaaaaaaaaaa123bbb#@$"; double count = Regex.Replace(str, @"[^a-zA-Z\u4e00-\u9fa5]", "").Length; Console.WriteLine(Math.Round(count / 10));
------解决方案--------------------
string s = "I Love 中文字";
int count=0;
foreach (char c in s)
{
if ((short)c > 256)
count++;
}
Console.WriteLine((count/10.0).ToString("f0"));
------解决方案--------------------
string s = "I Love 中文字"; int count=0; foreach (char c in s) { if ((short)c > 256) count++; } Console.WriteLine((count/10.0).ToString("f0"));