Sign in Join
FPDoc Onlineexperiment

AdjustLineBreaks function

In unit sysutils

Convert possible line-endings to the currently valid line ending.

Declaration

pascal
function AdjustLineBreaks(const S: string): string

Description

AdjustLineBreaks will change all occurrences of #13 and #10 characters with the correct line-ending characters for the current platform, or the specified platform if the 'Style' parameter was specified.

The platform-specific line-ending characters are:

  • #13#10 on Windows and DOS
  • #13 on Classic Mac OS before OS X
  • #10 on Unix clones / Linux / OS X / macOS.

Errors

None.

See also

Example: ex48

pascal
Program Example48;

{ This program demonstrates the AdjustLineBreaks function }

Uses sysutils;

Const
  S = 'This is a string'#13'with embedded'#10'linefeed and'+
       #13'CR characters';

Begin
  Writeln (AdjustLineBreaks(S));
End.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.