From: Isaac Sanders Date: 2011-11-02T12:34:59+09:00 Subject: Re: Sort order dilemma --20cf301b64ebfaee1f04b0b82783 Content-Type: text/plain; charset=ISO-8859-1 http://www.ruby-doc.org/core-1.9.2/Array.html#method-i-sort arr.sort do |x,y| if x.length < y.length return 1 elsif x.length > y.length return -1 else x <=> y end end On Tue, Nov 1, 2011 at 11:21 PM, Wayne Brissette wrote: > I've got a array that I need sorted in a certain way and I'm struggling to > figure out how to make it happen the way I want. > > Basically the array needs to be sorted like this: > > [A, B, C, AA, AB, AF ] > > that is, a single alpha character before it sorts the next character. > However, what I end up with when I sort is: > > [A, AA, AB, AF, B, C] > > How would I sort A to Z then AA-ZZ? > > Wayne > > > -- Sincerely, Isaac Sanders Section C-4B Vice Chief, Order of the Arrow Vice Chief of Administration, Tecumseh #65 Eagle Scout --20cf301b64ebfaee1f04b0b82783--