1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
function ExplodeGGMS(const S : string; var MS : TMemoryStream; Sep : Char) : Integer; // V4
var ic,ib : integer; buff : array [0..4096] of char;
begin Result:=0; ib:=-1;
for ic:=1 to length(S) do
begin if S[ic] <> Sep
then begin inc(ib); buff[ib]:=S[ic]; end
else begin Inc(Result);
inc(ib); buff[ib]:=#13;
inc(ib); buff[ib]:=#10; end;
end;
if S[length(S)] <> Sep then
begin inc(ib); buff[ib]:=#13; inc(ib); buff[ib]:=#10; end;
MS.Write(buff,ib+1);
end;
procedure TForm1.bExplodeGGMSClick(Sender: TObject);
var MS : tMemoryStream; i : integer; Chrono : oChrono;
begin ListBox1.clear;
Chrono.Top;
MS := tMemoryStream.create;
MS.Position:=0;
for i:=1 to 1000 do ExplodeGGMS(ligTests,MS,';');
labChrono.caption:='Mis : '+FloatToStrf(Chrono.Mis,ffFixed,10,2);
//< mis 1,12 ms avec Pentium III 1,13 Ghz
labChrono.upDate;
MS.Position:=0;
ListBox1.Items.LoadFromStream(MS);
labCount.caption:=IntToStr(ListBox1.Items.Count);
MS.Free;
end; |