TOF 🤦‍♂️: Replace EndOfLines: Strings end in EndOfLines?!?

see Replace EndOfLines: Strings end in EndOfLines?!? - Windows - Xojo Programming Forum

I find the “answers” less than impressive. Could SOMEONE tell the OP that he is using the wrong approach and point him to SPLIT and TRIM?

I think Kem’s RegEx solution is better than SPLIT and TRIM. As to the issue the OP was having, I posted a follow-up.

True. I was under the mistaken impression that Trim would also deal with other space characters like non-breaking space, thin space, etc that his regex will not deal with, but I just tried to make sure and it seems not.

a regex just seems overkill

strText=ReplaceAll( ReplacelineEndings(strText, EndOfLine), EndOfLine + " ", EndOfLine)

RegEx may be overkill for only a single space removal, but that was after he removed all double spaces using a loop. Kem’s RegEx code would replace both the loop and his final ReplaceAll.

Plus, the OP was doing pretty much what you are, except for converting the EndOfLines to the current platform. His issue stems from some anomaly that is yet to be confirmed.

I’ve only glanced at that thread

Busy pulling my hair out over other things :stuck_out_tongue:

I don’t think you can afford that …

… come to think of it, me neither … :older_man:

which code is that??

Follow the link.

Happy with that response now Markus? :slight_smile:

Now that we know its a custom app made in Xojo, here we go, I knew it reminded me of something that was in the back of my mind [feedback://showreport?report_id=51479]. It’s a known bug from 2018!!
Extra line added when copy and pasting from and to a textarea
When you copy and paste from and to a textarea an additional blank line is added to the content but only if that content is over multiple lines.
This perfectly explains why you only see it on the multiline example above.

Very nice and definite answer from you on the OPs problem. :+1:

So happy with the answer? Yes.
Happy it’s a bug? No.
Surprised it’s an unfixed bug? No.
Happy with Trim? No.

But Trim is easy enough to fix, so next time I fire up Xojo I might just write one …

And now we know the bug is in Xojo 2018 (the external tool the OP use)…:japanese_ogre: