If the buffer is indeed a string, you could also use Trim (or more specifically in this case, TrimRight) which removes leading and/or trailing whitespace (like #$D and #$A) from a string.

Regards,
Richard

----- Original Message ----- From: "Francois PIETTE" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Friday, May 13, 2005 11:52 AM
Subject: Re: java type



how can I delete the CR/LF pair:(#$D#$A)

Seems you are really new to Delphi !
You should probably post such question in a general purpose foru because it
is not really related to winsock !


Anyway, here is an answer:
What type is the variable where you get the data ?
If it is a string, you can simply reduce its length by two:
   SetLength(YourBuf, Length(YourBuf) - 2);
Or you can write safer code:
   if (Length(YourBuf) >= 2) and
      (YourBuf[Length(YourBuf)] = #10) and
      (YourBuf[Length(YourBuf) - 1] = #13)
   then SetLength(YourBuf, Length(YourBuf) - 2);

And there are also a myriad of ways achieving the same goal...

--
[EMAIL PROTECTED]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be




--- Francois Piette <[EMAIL PROTECTED]> a �crit: > > hi I send data from a java application to a dlphi > one > > using sockets, but when I send a string for > example > > '3' > > delphi read it '3'#$D#$A > > It means that you Java code send a line (that is > append a pair [#13#10 is CR/LF] to the data > you gave). > > > and when i print it on a TEdit it show me only 3 > but i can't use it > > what is the problem? > > CR/LF is control character that a TEdit is not able > to display. > Note that TWSocket "LineMode" can take advantage of > the CR/LF pair. When you trun LineMode to TRUE, > the component will assemble data received into lines > and trigger OnDataAvailable only when complete > line (that is anything followed by CR/LF pari) has > been assemble, and a OnDataAvailable event for > each line, even if the same network packet contains > several. > > -- > [EMAIL PROTECTED] > http://www.overbyte.be > > > _______________________________________________ > Delphi mailing list -> [email protected] > http://www.elists.org/mailman/listinfo/delphi >







____________________________________________________________________________
_
D�couvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos
mails, photos et vid�os !
Cr�ez votre Yahoo! Mail sur http://fr.mail.yahoo.com

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi



_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi






_______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

Reply via email to