Jump to content

Checking for Line Feed when reading from a file


MrAd

Recommended Posts

Hi All, I am working a file based note management project and have hit a bug I cant seem to fix, I have a text file with a seperate entry on each line of the file as an example: bonus/test/** - Hello.

 

I am writing an edit function for these notes and am having a problem with line feeds. I call up the desired line to be edited into a browser textarea and then the updated text gets written back to the file. After this the file is sorted alphabetically. The problem is if I dont use a line feed the edited line ends up stuck to the end of another line in the file whereas if I do use a line feed and there is already a line feed then I end up with dozens of extra blank lines in my file. Is there a way to check for a line feed on the end of a string, so that I can then add one if necessary?

 

Many Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.