Modifier le contenu d'un RichEdit
Bonjour,
Je met dans un RichEdit ce que je lie d'un port Com, et voici ce que j'obtiens:
1-05-2-01 TEMP. ECHAP. APRES
H
C
4
H
5
A
0
U
D
I
ERE RECUP TD OK 373 °C
Il faudrait lire ceci :
1-05-2-01 TEMP. ECHAP. APRES CHAUDIERE RECUP TD H450 OK 373 °C
merci de votre aide
Avant tout merci de votre aide!
Gilbert, pour le #20, c'est une erreur de ma part, j'ai essayé de supprimer les (Space) $20.
Par contre avec ce code, il ne se passe rien dans mon RichEdit...
Code:
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; |