• 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: Differentiating between "A1", "A12", "A13"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Differentiating between "A1", "A12", "A13"


  • Subject: Re: Differentiating between "A1", "A12", "A13"
  • From: Steven Angier <email@hidden>
  • Date: Thu, 10 Jan 2002 08:59:56 +1100
  • Organization: Macscript.com

"Wadson, David" wrote:

> A list of files named:
>
> A1...plus some other characters
> A10...plus some other characters
> A11...plus some other characters
> A12...plus some other characters
> A2...plus some other characters
> A3...plus some other characters
> A4...plus some other characters
> A5...plus some other characters
> A6...plus some other characters
> A7...plus some other characters
> A8...plus some other characters
> A9...plus some other characters
>
> Two problems - there will be other files in the list named started with B1,
> B2,... C1, C2,...etc. I also won't know how many files will start with "A" -
> there could be 8, 10, or 12 files.

This is a common problem not unique to AppleScript. I think that you should generate names
with labels of a fixed width, with leading zero's if necessary, when the files are
originally created (if possible), thus:

A001
A002
A010
A999

This would ensure that the files are sorted in the desired order. You would then only need
to test for the prefix ("A", "B", "C" etc.) using a "starts with" operator. And having a
fixed-width label will make other parts of the filename easier to parse.

Steven Angier
Macscript.com


References: 
 >Differentiating between "A1", "A12", "A13" (From: "Wadson, David" <email@hidden>)

  • Prev by Date: Re: Resetting Hard Drive Names
  • Next by Date: Re: Tell application "Finder" not working
  • Previous by thread: Differentiating between "A1", "A12", "A13"
  • Next by thread: RE: Differentiating between "A1", "A12", "A13"
  • Index(es):
    • Date
    • Thread