ReplaceLineEndings Function

Replaces the line endings in the passed String with the specified line ending.

Syntax
result = ReplaceLineEndings( SourceString, LineEnding )

Parameters
SourceString | String | The original string.
LineEnding | String | The line ending used to replace the line endings in SourceString.

Return Value
Result | String | A copy of sourceString with the new line endings replacing the original line endings.

# Notes

ReplaceLineEndings does a global search-and-replace for the end of line characters in SourceString using the specified line ending as the replacement string. The search automatically recognizes Windows, Macintosh, and Unix line endings. Use this function to make multiline (or multi-paragraph) text compatible across platforms. The easiest way to specify the replacement line ending is with the EndOfLine class.

# Example

This example replaces the line endings in the text in an EditField with Windows line endings.

Dim s as String
s=ReplaceLineEndings(EditField1.Text, EndOfLine.Windows)

# See Also

EndOfLine class.