Arlen Cuss
10/27/2007 12:35:00 PM
On Sat, 2007-10-27 at 20:27 +0900, Greg Willits wrote:
> Greg Willits wrote:
> > '1sqHmb5b8G9mN' < '1Xv5LeB9bMdar'
> >
> > Wouldn't you think that is supposed to be TRUE ?
> 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"]
irb to the rescue:
irb(main):001:0> 'a' < 'b'
=> true
irb(main):002:0> "A" < 'b'
=> true
irb(main):003:0> "a" < "B"
=> false
irb(main):004:0> ?a < ?b
=> true
irb(main):005:0> ?A < ?b
=> true
irb(main):006:0> ?a < ?B
=> false
irb(main):007:0> ?A
=> 65
irb(main):008:0> ?a
=> 97
irb(main):009:0>
Ruby's sorting these strings by ASCII order, and as you can see here, capital letters come first! So "A" is always less than 'a', etc.
Arlen