+ 1

What is the logic behind string comparisons, why ("H">"c") is False and ("H">"C") is True? How does the case sensitivity works?

19th Apr 2017, 8:27 AM
Jeffrey Wong
2 Answers
+ 9
It checks for ASCII values.Google it.
19th Apr 2017, 8:29 AM
Meharban Singh
Meharban Singh - avatar
+ 9
Capital letter have ASCII values from 65-90, and small alphabets have values from 97-122. Then H=72 C=68 c=99 Therefore 'H'>'c' is false but 'H'>'c' is true. Hope this helps.
19th Apr 2017, 8:42 AM
Dragon Slayer Xavier
Dragon Slayer Xavier - avatar