RE: Differentiating between "A1", "A12", "A13"
RE: Differentiating between "A1", "A12", "A13"
- Subject: RE: Differentiating between "A1", "A12", "A13"
- From: "Wadson, David" <email@hidden>
- Date: Wed, 9 Jan 2002 23:51:15 -0500
True, but whether I have leading zeros or a specific character after each
filename, than I have to operate under the assumption that the user(s) have
named every file properly. I'm trying to put in some margin for error here
in case the user mistypes the name. I was hoping that there would be some
sort of easy routine for doing this. Too bad Applescript doesn't allow the
use of regular expressions because it looks like my only options are some
convoluted coding.
I suppose it might be easier to read the first three characters of every
filename and if the third character isn't a number, insert a leading zero so
that "1" would be formated as "01", etc....
>
----------
>
From: Steven Angier
>
Reply To: email@hidden
>
Sent: Wednesday, January 9, 2002 4:59 PM
>
To: 'Applescript'
>
Subject: Re: Differentiating between "A1", "A12", "A13"
>
>
"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.