• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to do a proper alphabetical sort?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to do a proper alphabetical sort?


  • Subject: Re: how to do a proper alphabetical sort?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 8 Mar 2007 19:36:43 -0500

On 3/8/07, Patrik B. <email@hidden> wrote:
Hi,

I am looking for a library or method that does an alphabetical sort?

I'm sure there's a way to do it with "pure" AS, but you can use the shell command "sort" to do it:

set unsortedList to { "apple", "Arthur", "Carl", "Betty", "candy", "dog" }
set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {ASCII character 10}
set sortedList to paragraphs of (do shell script "echo " & quoted form
of (unsortedList as string) & "| sort  -d -f")

That gives {"apple", "Arthur", "Betty", "candy", "Carl", "dog"} - not
exactly what you wanted since you specified uppercase before
lowercase, but perhaps good enough?

--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: how to do a proper alphabetical sort?
      • From: "Mark J. Reed" <email@hidden>
References: 
 >how to do a proper alphabetical sort? (From: "Patrik B." <email@hidden>)

  • Prev by Date: Re: Mod & Creation Dates
  • Next by Date: Re: how to do a proper alphabetical sort?
  • Previous by thread: how to do a proper alphabetical sort?
  • Next by thread: Re: how to do a proper alphabetical sort?
  • Index(es):
    • Date
    • Thread