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

来源:互联网 发布:软件如何做授权加密 编辑:程序博客网 时间:2024/04/26 12:34
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

0 0
原创粉丝点击