I just ran this code:

Var mystr As String

mystr = "aaa" + EndOfLine.macOS + "bbb" + EndOfLine.UNIX + "ccc" + EndOfLine.Windows + "ddd" + EndOfLine.CR + "eee" + EndOfLine.CRLF + "fff" + EndOfLine.LF + "ggg"

mystr = mystr.ReplaceLineEndings (", ")

system.DebugLog (mystr)

which gave a satisfactory result.

The doc for ReplaceLineEndings, however, talks about the replacement string being a LineEnding. Is there any chance I’m going to wake up one day with a new version of the IDE and suddenly find that this is now enforced?


1 Like

I think you misread the doc page. “LineEnding” is the name of the parameter. It’s type is String. So any string will work as a replacement.

1 Like

I think I read it quite carefully. My example showed that a string which is not a line ending, will work. But the doc page talks throughout as if the replacement string is expected to be a line ending. In the context in which I want to use ReplaceLineEndings, I want to use a string which is not a line ending. I just don’t want to get any surprises down the road.

Not allowing that would break a LOT of existing code so I wouldn’t expect them to ever change that… but then again from recent experience, one never knows.


1 Like

Then the documentation is misleading in calling the second parameter “LineEnding”. ReplaceLineEndings is a specialized version of ReplaceAll in that it doesn’t require a search string, but rather is aware of the 3 different kinds of line endings. The replacement can be anything. A very common usage is exactly what you are doing - forming a comma delimited string out of a list of terms that were one per line.

1 Like

OK thanks Tim and Karen. Just as long as I’m not the only one using it thus.