string a = "阿斯顿dfd发沙发 adfsfs.htm";
string b = System.Text.RegularExpressions.Regex.Replace(a, @"[^(\u4e00-\u9fa5)]", "");
Console.WriteLine(b);
输出结果为:
阿斯顿发沙发
用正则式取出String中的汉字
最新推荐文章于 2023-05-22 16:03:41 发布
string a = "阿斯顿dfd发沙发 adfsfs.htm";
string b = System.Text.RegularExpressions.Regex.Replace(a, @"[^(\u4e00-\u9fa5)]", "");
Console.WriteLine(b);
输出结果为:
阿斯顿发沙发