Page 1 of 1

How can I strip Enter / Return from a string?

Posted: Wed Apr 28, 2021 2:38 pm
by amyren
When exporting a table to a csv file, I have this one text variable that originates from a rapagui Texteditor.
But if I had used Enter / Return inside the texteditor, it will make unwanted linefeeds in the csv file.
If I look at the file inside notepad++ or similar, there are no "\n" inside the line. I can see the LF symbol if I turn on to show symbols.

How can I process the string variable in order to remove the linefeeds, or better convert them to "\n"?

Likewise, my program have the option to import the csv file. How could I convert the "\n" back to linefeeds?

btw, I use #ENCODING_ISO8859_1 when I write to the csv file.

Re: How can I strip Enter / Return from a string?

Posted: Wed Apr 28, 2021 4:40 pm
by plouf
isnt ReplaceStr(text$, "\r", "\n") works ?

Re: How can I strip Enter / Return from a string?

Posted: Wed Apr 28, 2021 11:22 pm
by amyren
:oops: Yes it does.
I was thinking there was some other code for it, since writing \n in the texteditor did not cause a linefeed.
But thanks, now I can export and import without worrying about those LF's.