The text of this article is not in this database — only its details are. Read it on the old site: How To Compare Strings In C#
11 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: How To Compare Strings In C#
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Yusuf AksoyPosted Jan 16, 2021, 8:39 PM
Thanks a lot.
Pankajkumar PatelPosted Sep 27, 2019, 12:39 AM
Nice article
Sourav Kumar DasPosted Sep 26, 2019, 12:54 AM
Nice article
Logesh PalaniPosted Jul 19, 2019, 10:57 PM
Write some output in command of code end, its more good understand
Cris GomezPosted Jun 5, 2019, 1:23 PM
Thanks, nice tutorial!
Hamid KhanPosted Feb 22, 2019, 4:08 AM
Thanks...............
Rushi MehtaPosted Sep 25, 2018, 1:53 AM
Great Article wrttien
Abhishek YadavPosted Aug 27, 2014, 2:47 PM
Oh !! Thanks Mahesh, now i understand where i made mistake, I thought it works on ASCII value and that's why there was some confusion, but now i understood that it works on alphabetic order like from a,b,c.....X,Y,Z and it compares the position of these letters right ??.
Abhishek YadavPosted Aug 25, 2014, 7:34 PM
Hello Mahesh, I have some doubt with Compare(), this method works by taking each characters of a string with their ASCII values right??? If yes then let's take an example of a and A. ACSII value of a = 97 and A = 65, when it compares these 2 string i.e. Compare("a","A"), it returns -1. in other way, Compare(97,65), value of a > value of A i.e. (97 > 65), which means first string is greater than second, As per the above table it supposed to return 1, then why it returns -1 ?? Please help.....
Anders AxiPosted Oct 22, 2010, 6:39 PM
string.Compare("W", "V") give the result 1, but string.Compare("WA", "VB") give the result -1 I'm at a computer with Swedish version of Windows, could that impact? Culture Info? The first case seems resonable (W is > V, as we speak strings), but what about case 2? Regards, Anders Axi