TStringList.SetText

From Soldat Community Wiki
Jump to: navigation, search
procedure SetText(Text: PChar)
 Text: contents to be parsed

Description

SetText parses the contents of Text and fills the stringlist based on the contents.
It regards Text as a series of strings, separated by end-of-line markers. Each of these strings is added to the stringlist.

Example

var
  s: TStringList;
  mypchar: PChar;

begin
  s := File.CreateStringList();
  mypchar := 'a' + #13 + #10 + 'b';
  
  s.SetText(mypchar);
  
  WriteLn(s.CommaText);
  // a,b
  
  s.Free;
end.