How to append one array to another array of the same type without using iterative statements (for or while loops) in Delphi?
Having two dynamic arrays arr1 and arr2
var
arr1, arr2: array of Integer;
. . .
SetLength(arr1, 3);
arr1[0] := 1;
arr1[1] := 2;
arr1[2] := 3;
SetLength(arr2, 3);
arr2[0] := 4;
arr2[1] := 5;
arr2[2] := 6;
you can append the first to the second like this:
SetLength(arr2, Length(arr2) + Length(arr1));
Move(arr1[0], arr2[3], Length(arr1) * SizeOf(Integer));
See System.Move.
As Uwe Raabe's comment points out, you can do as follows for managed types:
SetLength(arr2, Length(arr2) + Length(arr1));
for i := Low(arr1) to High(arr1) do
arr2[3+i] := arr1[i];