MathGroup Archive 2010

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

Search the Archive

Re: Sorting a list of names


Sort[Transpose[{StringSplit[names][[All, 2]], names}]][[All, 2]]

Best regards

Ingolf Dahl

> -----Original Message-----
> From: Jon Joseph [mailto:josco.jon at]
> Sent: den 7 september 2010 08:03
> To: mathgroup at
> Subject: [mg112269] Sorting a list of names
> 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: locating overlow/underflow
  • Next by Date: Re: FindRoots?
  • Previous by thread: Sorting a list of names
  • Next by thread: Re: Sorting a list of names