Sort sequences

|
Sort sequences in Delphi News / Other topic (part of our Pascal and Delphi Coding group).
Quick Search:
sequences
Sort sequences
|
|
|
|
Matt
|
|
Help !! In a listbox with sorted = True, the string '~sw.tmp' is less than the string 'sw.tmp'. However, when comparing the 2 with CompareStr function, suddenly '~sw.tmp' is greater than 'sw.tmp'. That causes a lot of grief as I loop down 2 sorted listboxes, constantly comparing current entries.
Any ideas ? Help much appreciated. Matt
|
|
Posted 25 years ago (Thread Starter)
|
|
| About Matt |
|
Approved member.
Member subscribes to this thread with a verified email.
Post ID #2330, 4 replies
Thread Started 5/30/2001 7:40:00 PM
View Counter=4278
Last Reply Posted 6/11/2001 8:17:00 AM)
|
|
|
|
Location=Canada
|
|
 |
|
|
|
Matt
|
|
Found out that much:
It's a "feature" a la Microsoft. A tilde (~) is actually ASC126 and therefore > than an A which is ASC65. Yet in Windows Explorer ~sw.tmp appears before asw.tmp. I guess the Listbox sort=property follows this, whereas CompareStr does not.
Anybody could point me to the rules how Windows Explorer "sorts". Is this published anywhere on the web ? I have to mimick this behaviour in order to get the job done.
TIA, Matt
|
|
Posted 25 years ago (Thread Starter)
|
|
| About Matt |
|
Approved member.
Member subscribes to this thread with a verified email.
Post ID #2365 (Level 1.1)
Reply to 2330
Thread Started 6/3/2001 8:57:00 AM
View Counter=2
|
|
|
|
Location=Canada
|
|
 |
|
|
|
Matt
|
|
Tx Scott. Meanwhile stumbled across a Delphi function called ANSIFileName. It compares 2 file-names and returns <0, >0 =0, like CompareStr() works. Seems to work, as it returns ~sw.tmp < sw.tmp = true, but I can't test with foreign locales. If you've come across anything, could you post it here ?
Many thanks, Matt
|
|
Posted 25 years ago (Thread Starter)
|
|
| About Matt |
|
Approved member.
Member subscribes to this thread with a verified email.
Post ID #2461 (Level 1.2)
Reply to 2330
Reply Posted 6/11/2001 7:36:00 AM
|
|
|
|
Location=Canada
|
|
 |
|
|
|
Scott Wehrly
Prestwood IT
(Inactive)
Las Vegas, NV USA
|
|
The sort ordering in Windows Explorer is not ASCII based, it's tied more to the UNICode rules for the locale you have set in Windows. There is probably a web page about locales and sort order on the MSDN sites.
For instance, a Dutch user would expect the names:
  Amsterdam  ─ntwerp  CopenhΣgen
to be sorted like this:
ááAmsterdam
áá─ntwerp
ááCopenhΣgen
not like this (the ASCII order):
ááAmsterdam
ááCopenhΣgen
áá─ntwerp
|
|
Posted 25 years ago
|
|
| About Scott Wehrly |
|
Inactive member.
Member does not subscribe to this thread.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #2399 (Level 1.3)
Reply to 2330
Reply Posted 6/6/2001 12:15:00 PM
|
|
|
|
Location=Las Vegas, NV USA
|
|
 |
Most Recent Post
|
|
|
Scott Wehrly
Prestwood IT
(Inactive)
Las Vegas, NV USA
|
Actually, foreign locales are supported in Delphi!!!  I use the ShortDateFormat variable settings all of the time in Delphi, especially when I deal with databases with different standard Date formats. Well, that leads to the SysLocale system variable, which can be set in any scope in a Delphi program. Check out the description in the VCL Reference, and the accompanying Languages function (which tells you which Windows Locales are supported), and the Locale variable (for database queries using the BDE). 
|
|
Posted 25 years ago
|
|
| About Scott Wehrly |
|
Inactive member.
Member does not subscribe to this thread.
|
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
|
|
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html,
social networking links, message board signature, company profile, etc.
|
Post ID #2464 (Level 1.4)
Reply to 2330
Reply Posted 6/11/2001 8:17:00 AM
|
|
|
|
Location=Las Vegas, NV USA
|
|
Revive Thread!
Add a comment to revive this old thread and make this archived thread more useful.
| Thread #2330 Counter |
| 4278 |
|
Since 4/2/2008
|
|
|