Compare string case sensitively : String Compare : String C# Examples


C# Examples » String » String Compare »

 

Compare string case sensitively









    
using  System;  
  
class  MainClass  {  
    public  static  void  Main()  {  
        string  str1  =  "one";  
        string  str2  =  "ONE";  
  
        if(String.Compare(str1,  str2,  true)  ==  0)  
            Console.WriteLine(str1  +  "  and  "  +  str2  +  
                                                "  are  equal  ignoring  case.");  
        else  
            Console.WriteLine(str1  +  "  and  "  +  str2  +  
                                                "  are  not  equal  ignoring  case.");  
  
    }  
}
    
   
  
   



Output

one and ONE are equal ignoring case.


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String Compare