From: 7stud -- Date: 2008-01-24T10:36:42+09:00 Subject: Re: Alphabetizing Zenki Nine wrote: > Thanks All for helping me out on this.. > > Now..here's another issue..Say i want to display the retired players > last name in alphabetical order with its contents. Noticed this time > some has middle names, initials. > > How would I tackle this? > > Sorry, I've looked thru many books and have a difficult time solving > this.. > > retired_players = < Mike Anthony Gallego, 1985-1997 > Calvin Edwin Ripken, Jr., 1981-2001 > Tony K. Gwynn, 1982-2004 > Dennis Eckersley, 1975-1998 > PLAYERS > > Thanks, My attempt: retired_players = <p2.last end #Output the sorted players: sorted_players.each do |player| puts sprintf("%s, %s %s", player.last, player.first_middle, player.years) end --output:-- Eckersley, Dennis 1975-1998 Gallego, Mike Anthony 1985-1997 Gwynn, Tony K. 1982-2004 Ripken Jr., Calvin Edwin 1981-2001 -- Posted via http://www.ruby-forum.com/.