evo funkcije, ako nisi vec sam iskuco:
Code:
function AddLeadingNumber(ImePesme: string;RedniBroj, BrojDecimala:integer):string;
var i:integer;
a:string;
begin
a:=IntToStr(RedniBroj);
for i:=length(a) to BrojDecimala-1 do
a:='0'+a;
a:=a+'.';
Result:=a+ImePesme;
end;
function RemoveLeadingNumber(ImePesme: string):string;
begin
Result:=copy(ImePesme, pos('.',ImePesme)+1, length(ImePesme))
end;
Pozdrav
Edit:
Sa prvom funkcijom mozes dodati nula koliko hoces, pa bi bilo dobro da proveris da li je broj veci od 9, 99, 999, pa onda dodajes koliko ti treba nula. Glupo je da imas nule ako imas samo 5 pesama u playlistu.
Prilikom dodavanja pesama proveri koliko je pesama pa ako je potrebno uradi:
Code:
for i:=0 to ListBox1.Items.Count-1 do
ListBox1.Items[i]:=AddLeadingNumber(RemoveLeadingNumber(ListBox1.Items[i]),i+1,length(IntToStr(ListBox1.Items.Count)))
Valjda sam zatvorio sve zagrade.:)