Sign in Join
FPDoc Onlineexperiment

TextToSingleLine function

In unit LazStringUtils

Converts a multi-line string to a single line of text.

Declaration

pascal
function TextToSingleLine(const AText: string): string

Description

TextToSingleLine is a String function used to replace end-of-line characters (like CR (#13) and LF (#10)) in AText with Space (#32) characters. Duplicate adjacent Space characters are converted to a single Space character in the return value.

// uses LazStringUtils;
// var sMultiLn, sSingleLn: String;

sMultiLn := 'The rain  '#10' in Spain  '#13#10' falls  mainly  on  the  plain.  ';

sSingleLn := TextToSingleLine(sMultiLn);
// value is: 'The rain in Spain falls mainly on the plain.'

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