使用正则表达式计算字符串中中文字符的个数
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[\u4e00-\u9fa5]", System.Text.RegularExpressions.RegexOptions.Multiline); string strTemp = "随机产生了了多2333afadsg不筱个af575这样的了的算法"; MessageBox.Show(reg.Matches(strTemp).Count.ToString());
作者: 三角猫
http://www.zu14.cn/
转载请保留此信息