Sometimes you may need to check whether two strings are equal or not equal by checking case insensitive. See the example below to see how to achieve the same using C Sharp /C#.

using System;

class MainClass {
  public static void Main() {

    string strOne = "heaven";

    string strTwo = "HEAVEN";

    if(String.Compare(strOne , strTwo , true) == 0)
      Console.WriteLine(strOne + " and " + strTwo + " are equal - Case Insensitive!");

      Console.WriteLine(strOne + " and " + strTwo + " are not equal - Case Insensitive!");


Output : heaven and HEAVEN are equal – Case Insensitive!



Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.