Difference between revisions of "TStringList.AddStrings"

From Soldat Community Wiki
Jump to: navigation, search
(new page)
 
m
 
Line 11: Line 11:
 
var
 
var
 
   s,news: TStringList;
 
   s,news: TStringList;
  i: integer;
 
  
 
begin
 
begin

Latest revision as of 15:04, 24 August 2013

procedure AddStrings(Strings: TStrings)
 Strings: strings to be added

Description

AddStrings adds the contents of Strings to the stringlist. Any associated objects are added as well.

Example

The below example will spawn a medkit on the players position whenever he types "Medic!"

var
  s,news: TStringList;

begin
  s := File.CreateStringList();
  s.Append('a');
  s.Append('b');
  s.Append('d');
  s.Sort();
  s.Sorted := TRUE;

  news := File.CreateStringList();
  news.Append('ca');
  news.Append('cc');
  news.Append('cb');
  
  s.AddStrings(news);
  
  WriteLn(s.CommaText);
  // a,b,ca,cb,cc,d
  
  s.Free;
  news.Free;
end.