How to append one array to another array of the same type without using iterative statements (for or while loops) in Delphi?
In the last Delphi versions (XE7+) you can just use + operator or Concat routine to append arrays. Link. Official help (doesn't mention +)
Otherwise write your own procedure (use generic arrays if possible). Quick example (checked in XE3):
type
TArrHelper = class
class procedure AppendArrays(var A: TArray; const B: TArray);
end;
class procedure TArrHelper.AppendArrays(var A: TArray;
const B: TArray);
var
i, L: Integer;
begin
L := Length(A);
SetLength(A, L + Length(B));
for i := 0 to High(B) do
A[L + i] := B[i];
end;
usage:
var
A, B: TArray;
begin
A := TArray.Create('1', '2', '3');
B := TArray.Create('4', '5');
TArrHelper.AppendArrays(A, B);