Line break in text file?

Questions and answers on how to get the most out of FFAStrans
Post Reply
dries
Posts: 6
Joined: Fri Nov 10, 2023 8:17 am

Line break in text file?

Post by dries »

Hi all,

How can i put a line break when appending text from a variable to a text file?
I've tried but nothing seems to work.
Should be simple but i don't get the syntax used in ffastrans generate text file...

Thanks in advance...
emcodem
Posts: 1661
Joined: Wed Sep 19, 2018 8:11 am

Re: Line break in text file?

Post by emcodem »

Hi @dries,

what you write can mean different things, e.g. is your goal to put a line break only without a line feed, so only \n instead of \r\n?
However, i kind of doubt that and i believe you don't care if your newline constist of \r\n or only \r.

So, how can we write line breaks (and empty lines) with the write text file processor:

In the write text file processor, the "Text Field" input, you have to just make one empty line above the stuff you want to insert, so the first line there shall be a newline.

Code: Select all

%s_yourcontent%

(note that there are 2 new line characters after s_yourcontent in the code above, one newline after the text and another newline in the empty line.

But there is one pitfall with this: if the text file does not yet exist, the first line would also be an empty line.

Also, if you want to append one complete empty line before the new content, you would need to insert 2 emtpy lines, one to break the line after last existing sentence and another one to create a new line.

One alternative Way is to add a new line AFTER your variable in the text processor, for this you place the cursor before the END of your variable and hit 2x enter. This way, the new line is already there AND the text file does not start with an empty line for first line.

Last but not least, to check the full current content of a write text processor, you have to mark all using ctrl+a, insert it into notepad++ and hit the "show all characters" symbol middle top menu.
newlines.png
newlines.png (20.43 KiB) Viewed 158 times
In this screenshot we see 3 linefeed and newline (CR LF) couples which i usually refer to as \r\n. Note that the last line does not have a newline which means if you append text and you want an empty line, you have to start your append with 2x newlines instead of only 1
emcodem, wrapping since 2009 you got the rhyme?
Post Reply