Re: Sorting Text in ROR

Runa
Sat, 11 Jun 2011 06:10:09 -0000

Thanks Walter and Kendall.

But ouput which I get using sort mentioned  is as follows

>> a = [ "A Sharma", "A. Zah", "Aarti Jain",
"A. Bansal", "Bindu Lakra" ]
=> ["A Sharma", "A. Zah", "Aarti Jain",
"A. Bansal", "Bindu Lakra"]
>> a.sort {|x,y| y <=> x}
=> ["Bindu Lakra", "Aarti Jain", "A. Zah",
"A. Bansal", "A Sharma"]

I want my sort to skip "." and spaces while sorting.

My intended output is
=> ["Aarti Jain", A. Bansal", "A Sharma","A.
Zah", "Bindu Lakra" ]


Is there any way to get it sorted the way i wanted where . and space
is not considered while sorting?