Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Sorting Strings: How and Why so f$&!ing hard?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60843] Re: [mg60802] Sorting Strings: How and Why so f$&!ing hard?
  • From: János <janos.lobb at yale.edu>
  • Date: Fri, 30 Sep 2005 03:57:11 -0400 (EDT)
  • References: <200509290941.FAA01037@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Sep 29, 2005, at 5:41 AM, Michael A. Gilchrist wrote:

> Hi,
>
> I'm trying to sort the following list.  I eventually resorted to  
> doing it
> by hand but would like to know why Mathematica's sort won't do it.
>
> In[1]= Sort[{"AG17.TXT", "BM14.TXT", "CC03.TXT", "GP21.TXT",  
> "IG06.TXT",
> "SDR19.TXT, AG18.TXT", "CA09.TXT", "CC04.TXT", "GP22.TXT", "PK07.TXT",
> "SDR20.TXT, BM13.TXT", "CA10.TXT", "CD15.TXT", "IG05.TXT",  
> "PK08.TXT"}]
>
> Out[1]= {"AG17.TXT", "BM14.TXT", "CA09.TXT", "CA10.TXT", "CC03.TXT",
> "CC04.TXT", "CD15.TXT", "GP21.TXT", "GP22.TXT", "IG05.TXT",  
> "IG06.TXT",
> "PK07.TXT", "PK08.TXT", "SDR19.TXT, AG18.TXT", "SDR20.TXT, BM13.TXT"}
>
>
>
> Should this really be so hard?

Not if you add the four missing quotes to it :)

"SDR19.TXT, AG18.TXT"  and "SDR20.TXT, BM13.TXT" should be:

"SDR19.TXT", "AG18.TXT"  and "SDR20.TXT", "BM13.TXT"

I think.

János


  • Prev by Date: Re: Bug in Mathematica ?
  • Next by Date: Re: nonlinear fit question
  • Previous by thread: Sorting Strings: How and Why so f$&!ing hard?
  • Next by thread: Re: Sorting Strings: How and Why so f$&!ing hard?