From: Devin Mullins Date: 2006-09-20T12:10:58+09:00 Subject: Re: What's the ruby way to sort string with cases in mind Sam Kong wrote: > I'd like to sort an array of strings case-insensitively. Alternate method (slightly "faster", maybe): a = %w(a c b A C B) a.sort {|a,b| a.casecmp b} #=> ["a", "A", "b", "B", "c", "C"] > Actually, I want ["A", "a", "B", "b", "C", "c"] . > I can get the result with the following trick. > > a.sort_by {|i| i.upcase + i} Clever. > But I think there's a more rubyish way. > How do you do that? No clue. Maybe implement your own comparator? {|a,b| dict_order(a,b)}? Devin