[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'LazStringUtils' (#lazutils)

ChangeLineEndings

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

Declaration

Source position: lazstringutils.pas line 50

function ChangeLineEndings(

  const s: string;

  const NewLineEnding: string

):string;

Arguments

s

  

Values examined in the routine.

NewLineEnding

  

End-of-line character sequence applied to the return value.

Function result

Value from S after conversion of line endings.

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 ('').


Version 4.0 Generated 2025-05-03 Home