casecmp method in String class has a little unusual behavior

"abcdef".casecmp("abcde") #=> 1 "aBcDeF".casecmp("abcdef") #=> 0 "abcdef".casecmp("abcdefg") #=> -1 "abcdef".casecmp("ABCDEF") #=> 0

Ok everything all right but there is uncertain behavior here

('abcdef').casecmp('3') #=> 1 ('dkjasfdkefk').casecmp('0') #=> 1 ('dkjasfdkefk').casecmp('-1') #=> 1

Ruby_Flaw.txt (62 Bytes) Pankaj Doharey, 12/11/2011 11:16 pm