Kod: Tümünü seç
var
i,count:integer;
thisstring,laststring:string;
begin
listbox3.Clear;
ListBox1.Sorted := true;
count := 1;
lastString := '';
for i:=0 to ListBox1.Items.Count-1 do begin
thisString := ListBox1.Items[i];
if thisString = lastString then
count := count + 1
else
if lastString <> '' then begin
ListBox3.Items.Add('['+IntToStr(count)+ ']-' +lastString);
count := 1;
end;
lastString := thisString;
end;
if count > 0 then
ListBox3.Items.Add('['+IntToStr(count)+ ']-' +lastString);