1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| procedure SupprChar(const S : string; var MS : TMemoryStream; CharSuppr : Char);
const ibMax = 65536;
var ic,ib,transf : integer; buff : array [0..ibMax] of char;
begin ib:=-1; transf:=0; MS.Position:=0;
for ic:=1 to length(S) do
begin if S[ic] <> CharSuppr
then begin inc(ib); buff[ib]:=S[ic]; inc(transf); end;
if transf=ibMax+1 then
begin MS.Write(buff,transf); ib:=-1; transf:=0; end;
end;
if transf<>0 then MS.Write(buff,transf);
end;
procedure TJournaux.SpeedButton3Click(Sender: TObject);
var MS : tMemoryStream; i : integer;
begin MS := tMemoryStream.create;
SupprChar(RichEdit_Journaux.Text,MS,#13); // #13 = CR = Carriage Return
SupprChar(RichEdit_Journaux.Text,MS,#10); // #10 = LF = Line Feed
MS.Position:=0;
RichEdit_Journaux.Lines.LoadFromStream(MS);
MS.Free; |
Partager