Page 1 of 1
Deleting a blank last line of exported text file
Posted: Tue Jan 21, 2014 2:48 am
by magice
I am working on a script that reads a text file, modifies it for purposes of making it importable to another application and saves it. That is all simple enough. My problem, however, is that there always seems to be an empty line at the end of the file. I have tried everything I can think of, and have determined that it must be part of the way that LiveCode writes to a file. Is there any way to eliminate that last empty line?
Re: Deleting a blank last line of exported text file
Posted: Tue Jan 21, 2014 2:59 am
by Dixie
It might be something as simple as a 'trailing' carriage return...
try putting the text into a variable, called say 'theText' and delete the last character of it...
Re: Deleting a blank last line of exported text file
Posted: Tue Jan 21, 2014 3:38 am
by magice
Dixie, you are a genius. That was actually the first thing i thought of, but I discounted the thought because of the possibility of the file not having the CR as the last char. I then focused on the last line and evaluating if it were empty. Your way works for me in an if statement.
Code: Select all
if the last char of tExport is cr then delete the last char of tExport
Thank you for making me rethink my over thinking.