language agnostic - String Compare "Logic" -
Can anyone tell me why why string compare below distribute these results?
& gt; "1040" & lt; = "12000" True & gt; & Gt; "1040" & lt; = "10000" false
I have tried to compare the string in both c and python, the result is obviously correct, i just do not know how the results are calculated. . PS: I know that you should not do anything to compare the strings of different lengths, but I am still thinking about the logic behind the lines above ;-)
"1" is equal to "1".
"0" comes before "2" ("1040"> "12000").
"4" comes after "0" (so far "1040"> "10000").
Comments
Post a Comment