Re: Sorting A List - Need Help
Re: Sorting A List - Need Help
- Subject: Re: Sorting A List - Need Help
- From: "Steven D. Majewski" <email@hidden>
- Date: Sat, 26 Jul 2003 20:27:30 -0400
On Saturday, July 26, 2003, at 07:36 PM, Rick Bargerhuff alias cougar
wrote:
>
>
Ok, this is a special case and would work if the file names were named
>
using the same scheme...
>
But my scenario would be global. Meaning I don't really know what the
>
naming scheme would be.
>
>
See Mac OS X Finder seems to sort the files correctly regardless if
>
the naming scheme is special or not.
>
>
I need to somehow reproduce that sorting algorithm the Finder uses.
>
It only seems right to mimic the Mac
>
OS X Finder's way of sorting. Now the bigger question is, is the
>
Finder's method of sorting correct? I been
>
doing alot of research on sorting and I have come to realize that
>
there is no real way to sort... it all boils down
>
to what your sorting. In this case, I'm sorting file names. But now
>
my problem is, there is 2 ways to sort file names,
>
Dictionary style, and numerically. Dictionary is what is returned by
>
the Finder in a list folder call... Numerically is
>
what the Finder does with a bunch of files with numerics at the end.
>
So it is a combination of the 2.
>
>
Hope that further explains the dilemma I'm in
>
Obviously, the Finder does not do either a strictly alphabetic or
numeric sort.
See my previous post about how the Finder handles "1_1" , etc. and why
my
solution was to break the name into separate fields and sort each.
After a little experimentation with generating a bunch of filenames and
looking
at them in the finder, my guess at the Finder's sort algorithm is that
it
breaks names into numeric and non-numeric fields, and then sorts over
each
field with a numeric or alphabetic sort as appropriate.
For example, it orders the following files:
1a1, 1a2, 1a3, 1a12, 1a15, 1a20
which all fall after 1-1, ... etc., which fall after 1_1 ...
-- Steve Majewski
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.