SetLength
From SCAR Divi Manual
Contents
Definition
procedure SetLength(var s; NewLength: Integer);
Availability
SCAR Divi 3.00 > Current
Description
Sets the length of an array/string passed in s to a given length NewLength.
Example 1 (Arrays)
var TIA: TIntArray; begin SetLength(TIA, 5); TIA[0] := 2; TIA[1] := 4; TIA[2] := 6; TIA[3] := 8; TIA[4] := 10; WriteLn(TIAToStr(TIA)); end.
Output:
2,4,6,8,10
Example 2 (Strings)
var s: string; begin SetLength(s, 5); s[1] := 'a'; s[2] := 'b'; s[3] := 'c'; s[4] := 'd'; s[5] := 'e'; WriteLn(s); end.
Output:
abcde