TStringList.Text

From Soldat Community Wiki
Revision as of 17:14, 24 August 2013 by Mighty (talk | contribs) (new page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
property Text: String
 Access mode: RW

Description

Text returns, when read, the contents of the stringlist as one big string consisting of all strings in the list, separated by an end-of-line marker. When this property is set, the string will be cut into smaller strings, based on the positions of end-of-line markers in the string. Any previous content of the stringlist will be lost.

If any of the strings in the list contains an end-of-line marker, then the resulting string will appear to contain more strings than actually present in the list. To avoid this ambiguity, use the CommaText property instead.

Example

var
  s: TStringList;
  i: Integer;

begin
  s := File.CreateStringList();

// WRITING
  s.Text := 'a' + #13 + #10 + 'b';
  WriteLn(s.CommaText);
  // a,b
  
// READING
  s.Append('c');
  WriteLn(s.Text);
  {
  a
  b
  c
   
  }
  
  s.Free;
end.