Hi i tried to validate this code #$0D witch is returned by device connected serial port the way to validate is string empty o line empty but i don't get validate..
procedure TFormMain.DPSerialDataAppear(Sender: TObject);
var
Str: AnsiString;
begin
sStr := DataPort.Pull();
begin
Index := 1;
// while Index <= length(Str) do
// if (Str[Index] in [chr(0)..chr(9),chr(14)..chr(32),chr(255)]) then
// delete(Str, Index, 1)
// else inc(Index);
// while Index <= length(Str) do begin
// ca:= Copy(Str, Index,1);
// inc(Index) ;
// end;
if( Str <>'#$0D' then begin // If put chr(10) and chr(13) on previos while eliminte those chr only need validate if str don't contain more information.. if str conain only this character line is empty..
Memo.Text := Memo.Text + Str;
end;
if(Length(str)>0 ) then begin
Memo.Text := Memo.Text + Str;
Memo.SelStart:= Length(Memo.Text);
end;
end;