解决正则中文
public static int getlength(string strsource)
{
regex regex = new regex("[u4e00-u9fa5]+", regexoptions.compiled);
int nlength = strsource.length;
for (int i = 0; i < strsource.length; i++)
{
if (regex.ismatch(strsource.substring(i, 1)))
{
nlength++;
}
}
return nlength;
}
Copyright © 2019- huatuo6.cn 版权所有 赣ICP备2024042791号-9
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务