Deleting a blank last line of exported text file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Deleting a blank last line of exported text file
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
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...
try putting the text into a variable, called say 'theText' and delete the last character of it...
Code: Select all
delete the last char of theText
Re: Deleting a blank last line of exported text file
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.
Thank you for making me rethink my over thinking.
Code: Select all
if the last char of tExport is cr then delete the last char of tExport