TSubstringList.Create Constructor

Overload List

#SignatureDescription
1constructor Create; overload;An empty list with Capacity 128.
2constructor Create(const OwnsObjects: Boolean); overload;An empty list with Capacity 128 that frees its items' objects when OwnsObjects is True.
3constructor Create(const QuoteChar, Delimiter: Char); overload;An empty list with Capacity 128, quoting with QuoteChar and delimiting with Delimiter.
4constructor Create(const ACapacity: Integer); overload;An empty list with room for ACapacity items, in steps of 128 rows, at least 128.
5constructor Create(const Duplicates: TDuplicates; const Sorted: Boolean); overload;An empty list with Capacity 128 and the given Duplicates and Sorted.

Overload 1: constructor Create; overload;

An empty list with Capacity 128.

Result: stored in self (calling object)

Remarks:

Not sorted, Duplicates dupIgnore, comparing by code unit, owning no objects. It grows by itself; Capacity reserves more rows ahead.

See Also: TSubstringList.Capacity

Overload 2: constructor Create(const OwnsObjects: Boolean); overload;

An empty list with Capacity 128 that frees its items' objects when OwnsObjects is True.

#NameDescription
1OwnsObjects

True: deleting an item, Clear and Free free its object.

Result: stored in self (calling object)

See Also: TSubstringList.OwnsObjects

Overload 3: constructor Create(const QuoteChar, Delimiter: Char); overload;

An empty list with Capacity 128, quoting with QuoteChar and delimiting with Delimiter.

#NameDescription
1QuoteChar

The quote of DelimitedText.

2Delimiter

The delimiter of DelimitedText.

Result: stored in self (calling object)

See Also: TSubstringList.QuoteChar, TSubstringList.Delimiter, TSubstringList.DelimitedText

Overload 4: constructor Create(const ACapacity: Integer); overload;

An empty list with room for ACapacity items, in steps of 128 rows, at least 128.

#NameDescription
1ACapacity

The number of items to hold without growing; Capacity is it rounded up to a multiple of 128.

Result: stored in self (calling object)

Examples

A list sized at creation.

uses Substr;

procedure Example;
var List: TSubstringList;
begin
    List := TSubstringList.Create(1000);
    try
        Assert(List.Capacity = 1024);
        Assert(List.Count = 0);
    finally
        List.Free;
    end;
end;
See Also: TSubstringList.Capacity, TSubstringList.Resize

Overload 5: constructor Create(const Duplicates: TDuplicates; const Sorted: Boolean); overload;

An empty list with Capacity 128 and the given Duplicates and Sorted.

#NameDescription
1Duplicates

What a sorted list's Add does with a text equal to an item.

2Sorted

Whether Add places each text at its sorted place.

Result: stored in self (calling object)

See Also: TSubstringList.Duplicates, TSubstringList.Sorted