<div class="meta" robots="noindex">

</div>

Method

# ReplaceLineEndings

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `String.ReplaceLineEndings<string.replacelineendings>` as a replacement.

</div>

## Description

Replaces the line endings in the passed `String</api/data_types/string>` with the specified line ending.

## Usage

*result*=**ReplaceLineEndings** (*SourceString*, *LineEnding*)

| Part         | Type                             | Description                                                                             |
|--------------|----------------------------------|-----------------------------------------------------------------------------------------|
| result       | `String</api/data_types/string>` | A copy of *sourceString* with the new line endings replacing the original line endings. |
| SourceString | `String</api/data_types/string>` | The original string.                                                                    |
| LineEnding   | `String</api/data_types/string>` | The line ending used to replace the line endings in *SourceString*.                     |

## 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</api/text/endofline>` class.

## Sample code

This example replaces the line endings in the text in a `TextField</api/deprecated/textfield>` with Windows line endings.

``` xojo
Dim s As String
s = ReplaceLineEndings(TextField1.Text, EndOfLine.Windows)
```

## Compatibility

All project types on all supported operating systems.

## See also

`EndOfLine</api/text/endofline>` class.
