Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to strip LF and CR from a tmemo.

Status
Not open for further replies.

Jerbear197

IS-IT--Management
Jul 29, 2021
1
GB
Hi Guys.
Only just joined and this is my first post.
I have a text file which I've loaded into a memo.
I want to strip out any CRLF's in this file.
I'm using StringReplace to replace any occurrence of Chr(13) and Chr(10) with single spaces
but for some strange reason it can't find them.
There is also numerous FF characters in this file which are required and it CAN find them.
Opening the text file in MS NotePad you can clearly see the FF character but not the CRLF's
and I know they are there as I can see them if I load the file in my Hex Viewer.

Anyone got any ideas as to why this might be.

Thanks
Jerry
 
CR/LF is part of how a text file is defined and any text control is going to use those as determinants in how to display the data. So you're not going to get any traction trying to look for them in a TMemo. What you basically need to do is load the file as a binary file and then strip them out that way (if byte = #13 or byte = #10). Of course, how you do that depends on what you're trying to get done in the end.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top