Board index » delphi » String lists not sorting properly, example code to try
t.h...@trl.telstra.com.au
![]() Delphi Developer |
Sun, 01 Jul 2001 03:00:00 GMT
String lists not sorting properly, example code to try
Further to my post a few days ago I have produced a small test app which
demonstrates the problem. It consists of a form with two list boxes and two buttons, ListBox2 is sorted, ListBox1 is not. The example has the word length set to 1 at the moment,which demonstrates the problem the best. It fills the first list with random strings and then copies them all over to the second list box. They should all be sorted into alphabetical order, however, you will notice that the upper and lower case letters are sorted randomly....WHY? I know the sorting algorithm uses the AnsiStrComp function and so upper and lower case letters appear together, but single character strings should group all the same lower and upper case letters together ie. should go a,a,a,a,A,A,A not a,a,A,a,A,A,a...............! unit SortTest; interface uses type var implementation {$R *.DFM} procedure TSortingChecker.Button1Click(Sender: TObject); const begin procedure TSortingChecker.Button2Click(Sender: TObject); begin end. -----------== Posted via Deja News, The Discussion Network ==---------- |