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

TextToSingleLine

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

Declaration

Source position: lazstringutils.pas line 96

function TextToSingleLine(

  const AText: string

):string;

Arguments

AText

  

Text values examined and converted in the routine.

Function result

Text after removing end-of-line characters and duplicate space characters.

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

Version 4.0 Generated 2025-05-03 Home