string first="x";
string second="x";
int res= string.Compare(first, second,true);
Response.Write(res.ToString());
Output:
0
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.
Tuesday, January 1, 2013
Compare string in C#.NET
Subscribe to:
Post Comments (Atom)
No comments:
Write comments