"For developers", "Server scripts", "Functions description", "Strings", "TStringList", "Methods", "Append".

 

Adding a string at the end of the list.

 

Syntax

procedure TStringList.Append(s: string);

 

Parameters and return values

Parameter

Type

Value

s

string

a string for adding to the list.

 

Function result

A string index. It is not necessary a sequence number as the list can be sorted. A numeration starts with zero.

 

Example

var
  SL: TStringList;
  i, x: integer;
begin
  SL := TStringList.Create;
  x := 0;
  
    for i := 1 to 10 do begin
      x := x + i;
      SL.Append(IntToStr(i) + ' - ' + IntToStr(x));
    end;
  
  mLogScript(CRLF + SL.Text, 'unsorted');
  
  SL.Free;
end.

Script work result

[10:58:48] (Log "AppendMethod"): [unsorted]

1 - 1

2 - 3

3 - 6

4 - 10

5 - 15

6 - 21

7 - 28

8 - 36

9 - 45

10 - 55

[10:58:48] (Run "AppendMethod"): Script operation time: 5 ms

[10:58:48] (Run "AppendMethod"): Script done successfully.
 

See also

CRLF

IntToStr
mLogScript

TStringList.Create

TStringList.Free

TStringList.Text