Can anybody please tell me why the string comparisons below deliver these results?
>>\"1040\"<=\"12000\"
True
>> \"1040\"<=\"1
In C, string comparisons are done character by character. In the first case, the first characters of the stings are equal, so it comes down to the second character: '0' is < '2', so "1040" < "12000". In the second case, the first two characters of the strings are equal, so the third character is the basis -- '4' > '0', so "1040" > "10000".
If you want them compared as numbers, you'll need to convert them to numbers first, then do the comparison.