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

StringListPartToText

Converts the specified lines in a TStrings instance to a string value.

Declaration

Source position: lazstringutils.pas line 74

function StringListPartToText(

  List: TStrings;

  FromIndex: Integer;

  ToIndex: Integer;

  const Delimiter: string;

  IgnoreEmptyLines: Boolean = False

):string;

Arguments

List

  

TStrings instance examined in the method.

FromIndex

  

First line includes in the text.

ToIndex

  

Last line included in the text.

Delimiter

  

Delimiter inserted between lines in the text.

IgnoreEmptyLines

  

Indicates if empty lines are excluded from the text.

Function result

Text representing the specified lines in the TStrings instance.

Description

StringListPartToText is a String function used to get a line of text which contains the specified range of lines from a TStrings instance.

List is the TStrings instance which contains the lines of text examined in the function.

FromIndex and ToIndex indicate the line numbers in List used in the return value for the function. They must contain valid ordinal positions, and are used to access the indexed Strings property in the TStrings instance.

If FromIndex contains -1, it defaults to the first ordinal position (0). ToIndex must be equal to or larger than the value in FromIndex, and valid for the number of Strings in the string list. It defaults to the upper limit for the string list when it is too large. FromIndex cannot have a value that is larger than the one in ToIndex.

No actions are performed in the function when List is unassigned (contains Nil), or when values in the FromIndex or ToIndex parameters are invalid. The return value is an empty string ('') in these scenarios.

IgnoreEmptyLines indicates whether empty lines in the string list are omitted from the return value for the function. When set to True, any Strings value that is an empty string ('') is discarded. Otherwise, the empty value is denoted by adding the value in Delimiter to the return value.

Delimiter contains the end-of-line sequence used to separate strings added to the return value.

See also

TStrings

TStringList


Version 4.0 Generated 2025-05-03 Home