C # Console Base Equals compares two strings, ignoring case

Source: Internet
Author: User
Tzu Chi Learning, technology is willing to learn. Good heart to create a lot of Masarica, after the shade. I write the experience today, I would like to see the text to enlighten.


Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;

Namespace ConsoleApplication6
{
    class program
    {
        static void Main (string[] args)
        {
            string s1 = "ABCD";
            String s2 = "ABCD";

            if (S1. ToUpper () ==s2. ToUpper ())
            {
                Console.WriteLine (compared with case insensitive, these two strings are the same);
            }

            if (S1. Equals (s2,stringcomparison.ordinalignorecase))
            {
                Console.WriteLine (compared with case insensitive, these two strings are the same);
            }

            Console.readkey ();}}







Thanksgiving has helped the heart less park people.
C # is excellent and worth learning. CONSOLE,ASP.NET,WINFORM,WPF, design patterns and so can be concerned about, broaden horizons.
The Visual Studio IDE is easy to use, recommended.
Note: This article is born of self-study notes, the quality of medium, so think twice before you do. Novice to this, can not be copied, should first study its image number, to be able to adapt when the natural jump out of deep pits.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.