From: Brian Candler Date: 2010-06-21T19:27:30+09:00 Subject: Re: String comparison. Why does Ruby consider this true? Michael Fellinger wrote: >>> %w[Xeo xeo ball ABC abc].sort.each{|word| p word => word.unpack('C*') } > {"ABC"=>[65, 66, 67]} > {"Xeo"=>[88, 101, 111]} > {"abc"=>[97, 98, 99]} > {"ball"=>[98, 97, 108, 108]} > {"xeo"=>[120, 101, 111]} > => ["ABC", "Xeo", "abc", "ball", "xeo"] > > There is always a way to make things work on both, it's just that I > don't care much about 1.8 anymore. That does work the same on both, but it doesn't give codepoints. $ irb --simple-prompt >> "groß".unpack("C*") => [103, 114, 111, 195, 159] >> RUBY_VERSION => "1.8.6" $ irb19 --simple-prompt >> "groß".unpack('C*') => [103, 114, 111, 195, 159] >> "groß".codepoints.to_a => [103, 114, 111, 223] >> RUBY_DESCRIPTION => "ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]" -- Posted via http://www.ruby-forum.com/.