Autor Beitrag
Cyborgmillenium
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Mo 01.07.02 17:19 
Hallo.

Wüsste gerne mal, wie ich Namen, die in einem Array gespeichert sind (z.B. 20 Namen) nach den alphabet sortieren kann und diese wieder in Variablen bzw. einem Array speichern kann.

Danke
Eisenherz
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: Mo 01.07.02 18:21 
Ich würde es mit TStringList und dessen Methode Sort machen

_________________
aloa Eisenherz
patrick
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1481

WIN2k, WIN XP
D6 Personal, D2005 PE
BeitragVerfasst: Mo 01.07.02 18:21 
muss es seín das der Array sortiert ist oder reicht es schon wenn nur die ausgabe z.B. eine Listbox sortiert erscheint?

_________________
Patrick
im zweifelsfall immer das richtige tun!!!
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mo 01.07.02 18:24 
Hallo,

über sortierung wurden schon (sehr dicke) Bücher geschrieben.

Am einfachsten zu verstehen sollte der Bubble-Sort sein. Sehr beliebt ist der Quick-Sort. Aber auch kompromisse wie der Shell-Sort können sehr interssant sein.

Wenn du nach diesen Namen Googelst solltest du reichlich beschreibungen dazu finden.

Gruß Klabautermann
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Mo 01.07.02 19:02 
Ich habe die Namen im Array gespeichert und will sie im StrigGrid ausgeben. Also würde es mir auch reichen, sie nur auszugeben und nicht vorher zu speichern.

Vielleicht kann mir ja mal einer ein Beispiel geben.
b.brecht
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: So 14.07.02 23:28 
mein Tipp: greife mal in die trickkiste!

du kannst einer ListBox die Eigenschaft SORTED:=true setzten.
Dann lädst du alle EInträge des Arrays dort hinein, danach wieder ins ARRAY zurück!
Cyborgmillenium Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Mo 15.07.02 21:05 
Ich hatte es schon geschafft, aber das hört sich einfacher an, werde ich mal versuchen.
Danke
b.brecht
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 81



BeitragVerfasst: Mo 15.07.02 21:20 
Kein Problem, hier ein Sample:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure orde;
var a:integer;
begin
Form1.ListBox1.sorted:=true;
FOR a:=0 to 100 do Form1.ListBox1.Items.Add(tabelle[a]); // tabelle ist das zu ordnende ARRAY
Form1.ListBox1.Refresh;
For a:=0 to 100 do tabelle[a]:=Form1.ListBox1.Items[a];
Form1.ListBox1.Destroy; //Nach wunsch löschen
end;
Pit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 160



BeitragVerfasst: Mo 15.07.02 22:29