On Sunday 28 May 2006 01:53, Simon Mara wrote:
> I don't have a Windows machine to test this with, so was wondering if
> someone could let me know what non-alpha character to append to a file name
> to ensure it ends up at the end of a list when sorted alphabetically.
>
> Eg *Test needs to go after Zebra where "*" is the character that will
> facilitate this.
>
> It would be also handy to know what character will force a file to the top
> of a list.
Try '~' for last, and '!' for first - but first read comments below:
There is no generally reliable way of doing it - it depends on the codeset you
a using on that particular machine and the characters allowed for the file
system used and the sorting algorithm used.
You can assume that wildcard characters ('*', '?') are usually not allowed
You cannot safely assume that the same sorting algorithm will be used
throughout
'z' has the ASCII value of 122 - anything with a value > 122 will *probably*
be sorted afterwards - but again, it depends on the sorting algorithm used -
and you cannot rely on newer versions of Windows (more unicode ready) will
use the same sorting algorithms as older ones
The tilde character '~' (ASCII 126) might work in most cases as 'last', (works
for me on most UNIX file systems), but I am not sure whether it is a legal
character to begin a filename with in both FAT, FAT32 and NTFS file systems
(which, if you restrict yourself to Windows only, are the minimum you have to
consider)
'A' has an ascii value of 65, but 'a' = 97 - you see that case sensitive
algorithms will yield a different sort order than non-case sensitive ones.
The '!' character (ASCII 33) might work (does on most UNIX file systems) but
gain I don't know whether it is a legal character as first character on
Windows file systems
Good luck.
Horst
_______________________________________________
Gpcg_talk mailing list
[email protected]
http://ozdocit.org/cgi-bin/mailman/listinfo/gpcg_talk