您的位置:首页 > 编程语言 > C#

C# 比较字符串是否相等 0009

2016-04-21 17:16 597 查看
using System;

namespace StringApplication
{
class Program
{
static void Main(String []args)
{
string str1 = "This is text";
string str2 = "This is test";
if (String.Compare(str1, str2) == 0)
{
Console.WriteLine(str1 + "and" + str2 + "This are equal");
}
else
{

Console.WriteLine(str1 + "and" + str2 + "This are not equal");
}
Console.ReadKey();

}
}
}


output:

This is textandThis is testThis are not equal
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: