.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Sensitive and insensitive comparison of string

Posted By:Hiren Soni       Posted Date: August 29, 2010    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Sensitive and insensitive comparison of string
 


Sensitive and insensitive comparison of string


Sensitive and insensitive comparison of string:

// you can make use of string.compare() function



// string.compare(string arg1,string arg2,bool IsIgnoreCase)





string s1 = "Hello";

string s2 = "hello";



if (string.Compare(s1, s2, true) == 0)

{

MessageBox.Show("Both strings are Same in insensitive mode");

}

else

{

MessageBox.Show("Both strings are not Same in insensitive mode");

}







if (string.Compare(s1, s2, false) == 0)

{

MessageBox.Show("Both strings are Same in sensitive mode");

}

else

{

MessageBox.Show("Both strings are not Same in sensitive mode");

}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend