日期:2014-05-18 浏览次数:21011 次
string s1 ="打"; string s2 = "打击"; if (s1 == s2) Console.WriteLine("字符串相等"); else Console.WriteLine("字符串不相等");
------解决方案--------------------
string ss0 = "打";
string ss1 = "打击";
if(ss0.CompareTo(ss1) == 0)
Console.WriteLine("字符串匹配");
else
Console.WriteLine("字符串不匹配");
------解决方案--------------------
^打[\u4e00-\u9fa5]?$
------解决方案--------------------
用string类的静态方法compare,看看行不行
------解决方案--------------------
string s1 ="打";
string s2 = "打击";
if (ss0.Equles(ss1))
Console.WriteLine("字符串相等");
else
Console.WriteLine("字符串不相等");