 <p>Length <em>is</em> taken into account, but not in the way you expect. In string comparison, the first characters of each string are compared to each other first. If they are equal, then the second characters are compared and so on. So in your example, the first characters to be compared are '1' and '8'. '8' is larger. </p> <p>If you had compared "10.72" against "1.87", the first characters would be equal, so the next thing would be to compare "0" against ".".</p> <p>If you want to compare numeric values, you have to convert the strings to their numeric representation, or else you would have to write your own comparator that would treat strings as numerics. I hope that sheds some light on it.</p>