Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'How to sort Strings in SubLists?' topicStudent Support Forum > General > Archives > "How to sort Strings in SubLists?"

Next Comment >Help | Reply To Topic
Author Comment/Response
centurion
01/25/12 09:28am


Sorting by the second Element (Number): OKAY
Sort[{{"aa", 2}, {"cc", 1}, {"bb", 3}}, #1[[2]] < #2[[2]] &]
{{"cc", 1}, {"aa", 2}, {"bb", 3}}

Sorting by the first Element (String): undefinied ???
In[21]:= Sort[{{"aa", 2}, {"cc", 1}, {"bb", 3}}, #1[[1]] < #2[[1]] &]
Out[21]= {{"aa", 2}, {"cc", 1}, {"bb", 3}}

How can i get the answer:
{{"aa", 2}, {"bb", 3}, {"cc", 1}}


It is for processing a list with address data
thx!

URL: ,

Subject (listing for 'How to sort Strings in SubLists?')
Author Date Posted
How to sort Strings in SubLists? centurion 01/25/12 09:28am
Re: How to sort Strings in SubLists? Nasser M. Ab... 01/26/12 01:12am
Re: How to sort Strings in SubLists? Bill Simpson 01/26/12 01:18am
Next Comment >Help | Reply To Topic