String MyStrA="Microsoft ";
String MyStrB="MicroSoft ";
String MyInfo="";
MyInfo+="\n不分区字母大小写比较"+MyStrA+"和"+MyStrB+"是";
if(String.Compare(MyStrA,MyStrB,true)==0)
MyInfo+="相同的!";
else
MyInfo+="不同的";
MessageBox.Show(MyInfo , "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
MyInfo = "";
MyInfo += "\n分区字母大小写比较" + MyStrA + "和" + MyStrB + "是";
// if (String.Compare(MyStrA, MyStrB,false) == 0)
if (String.Compare(MyStrA, MyStrB) == 0)
MyInfo += "相同的!";
else
MyInfo += "不同的";
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|