Tuesday, January 1, 2013

Compare string in C#.NET

string first="x";
string second="x";
int res= string.Compare(first, second,true);


Above code will compare the two strings "first" and "second" if the strings are equal string.Compare method will return 0 if not equal it will return -1.

Third parameter passed in the string.Compare method will ignore the case.

No comments:
Write comments
Recommended Posts × +