Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How to remove line feed from ascii string
I have a program where an ascii string is received from the serial port and put into an sbuf (serial buffer) . When I display the string in a TListBox the line feed shows up as a small black vertical line. I have include a code snippet where I receive the string into the serial buffer. I was wondering if anyone can tell me a good way to remove the line feed before going to the TListBox. Also note that the string does not have a carriage return just a line feed. Thank you in advance!
procedure TForm1.rxProc(const buf; len: word);
for idx := 0 to len - 1 Do Begin
bx := TByteArray(buf) [idx]; // Get next byte
sbuf := sbuf + CHR(bx); //Append byte to string
if (bx = 10) then begin // Byte is LF
SendData (sbuf); //Send serial buffer to map server
lb.Items.Insert(0, sbuf); //Insert sbuf at top of listbox
sbuf :=''; // Clear sbuf
0 · ·