MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Sorting a list of names

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112269] Sorting a list of names
  • From: Jon Joseph <josco.jon at gmail.com>
  • Date: Tue, 7 Sep 2010 02:02:55 -0400 (EDT)

All: I have a list of names read in as strings with first names first. 
Can anyone suggest a mechanism to sort the list by the last names with 
the final output being the entire name?

Starting array:

names = {"Cole Dockter", "Mackenzie Christensen", "Rebecca Eastham", 
"David Gartzke", \
"Matthew Lundberg", "Tyler Hullett", "Cecilia Ford", "Grant Patterson"}

Ending array:

names_sorted = {"Mackenzie Christensen", "Cole Dockter", "Rebecca 
Eastham", "Cecilia Ford", "David Gartzke", "Tyler Hullett", "Matthew 
Lundberg", "Grant Patterson"}

As a note Sort[StringSplit[names][[All, 2]]] does exactly what I want 
except it drops the first name on output.=


  • Prev by Date: Re: Help with differential equation
  • Next by Date: Re: Help with differential equation
  • Previous by thread: Re: What is the problem? There are no images and no wrong reports for this small program.
  • Next by thread: Re: Sorting a list of names