procedure SetText(const Value: string); overload;
Replaces the items by the lines of Value; Value takes every text kind.
| # | Name | Description |
|---|---|---|
| 1 | Value | The lines; it may be an item of this list. |
Result: stored in self (calling object)
Remarks:
With LineBreak sLineBreak a line ends at #13#10, #13 or #10; with another LineBreak at exactly that text; with an empty LineBreak Value is one item. A last line break adds no empty item. A sorted list adds each line at its place. More lines than free rows grow the list as Add does.
Examples
Lines in and out.
uses Substr;
procedure Example;
var List: TSubstringList;
begin
List := TSubstringList.Create(8);
try
List.SetText('one'#13#10'two'#10'three');
Assert(List.Count = 3);
Assert(List[2] = 'three');
Assert(List.Text = 'one'#13#10'two'#13#10'three'#13#10);
List.TrailingLineBreak := False;
Assert(List.Text = 'one'#13#10'two'#13#10'three');
finally
List.Free;
end;
end;