Sign in Join
FPDoc Onlineexperiment

ChangeLineEndings function

In unit LazStringUtils

Converts CR and LF characters in s string to the specified line-ending sequence.

Declaration

pascal
function ChangeLineEndings(const s: string; const NewLineEnding: string)
: string

Description

ChangeLineEndings is a String function used to convert CR or LF characters in a string to the specified line-ending character sequence. ChangeLineEndings assumes that values in S are single-byte values and not multi-byte UTF-8 characters.

ChangeLineEndings iterates over the byte values in S, and replaces any occurrences of CR (#13), LF (#10), or CR+LF (#13#10) to the specified end-of-line character sequence. No actions are performed in the function when S is an empty string ('').

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.