64,701
社区成员
发帖
与我相关
我的任务
分享
static void Main(string[] args)
{
string a = "fa75bscx8ke有啦34很多6ff汉字的7啦2";
string b = "a345bc汉字xx8s";
Regex r = new Regex(@"[\u4e00-\u9fa5]");
MatchCollection mc1 = r.Matches(a);
MatchCollection mc2 = r.Matches(b);
if (mc2.Count > mc1.Count)
{
Console.WriteLine("不匹配");
return;
}
for (int i = 0; i < b.Length; i++)
{
if (!a.Contains(b[i].ToString()))
{
Console.WriteLine("不匹配");
return;
}
}
Console.WriteLine("匹配");
}