From: Greg Willits Date: 2007-10-27T20:27:01+09:00 Subject: Re: Error in Ruby text comparison? Greg Willits wrote: > '1sqHmb5b8G9mN' < '1Xv5LeB9bMdar' > > Wouldn't you think that is supposed to be TRUE ? > > All my text editors and Excel and Numbers all sort it so that 1s... > comes before 1X... > > But Ruby says the above comparison is false. > > What am I missing? Strange, this list: s, S, s, a, B in Excel, Numbers, and in Araelium Edit comes out as this when sorted a, B, s, S, s TextWrangler puts them as a, B, s, s, S Ruby sorts ['s','S','s','a','B'].sort as ["B", "S", "a", "s", "s"] MySQL (as I have it set up) sorts like the OS X apps. Trying to do a binary search with a ruby array based on text sorted by something else is getting hosed. Oh... duh, have Ruby sort it :-P Could get very expensive, but I guess I'll have to do it. -- gw -- Posted via http://www.ruby-forum.com/.