---
url: >-
  /statelake/scripting-reference/functions-and-procedures/string-functions/encodelinefeeds.md
---

# EncodeLineFeeds

The function **EncodeLineFeeds** converts carriage return #13 and line feed #10 in **aInputString**, into the characters specified by the **aReplace** characters.

**Declaration**: Function EncodeLineFeeds( aInputString : string; aReplace : string) : string;

An example follows.

```pascal
procedure OnMapEvent(var Value:Variant);
Var Str1 : string;
begin
 //Converts #13#10 (carriage return/line feed) to the given characters
  Str1 := EncodeLineFeeds(aString, '/n');
end;
```

The carriage return/line feed can be imbedded or interpreted in several ways, as is shown by the following code which uses example of both **EncodeLineFeeds** and **DecodeLineFeeds**.

Please also refer to [DecodeLineFeeds](/statelake/scripting-reference/functions-and-procedures/string-functions/decodelinefeeds).

```pascal
procedure ScriptEvent(var Value:Variant);
Var
  Str1, Str2, Str3 : string;
begin
 //Embeds using a plus sign (+) separator
  Str1 := ('Hello '+#13+#10+' World!');
  LogInfo(Str1);                                //Returns   Hello  World!
  Str2 := (EncodeLineFeeds(Str1, '/n'));
  LogInfo(Str2);                                //Returns   Hello /n World!
  Str3 := (DecodeLineFeeds(Str2, '/n'));
  LogInfo(Str3);                                //Returns   Hello  World!

 //Embeds using no separator
  Str1 := ('Hello '+#13#10+' World!');
  LogInfo(Str1);
  Str2 := (EncodeLineFeeds(Str1, '/w'));
  LogInfo(Str2);
  Str3 := (DecodeLineFeeds(Str2, '/w'));
  LogInfo(Str3);

 //Embeds using a plus sign (+) separator and the Chr function
  Str1 := ('Hello '+Chr(13)+Chr(10)+' World!');
  LogInfo(Str1);
  Str2 := (EncodeLineFeeds(Str1, '/x'));
  LogInfo(Str2);
  Str3 := (DecodeLineFeeds(Str2, '/x'));
  LogInfo(Str3);
end;
```
