Question : Delphi  Is there a simple way to Concat two Dynamic Arrays in to one Array?

I have two Arrays
AVar Array1, Array2 : Array Of String;

Is there a way to concatinate the contents of both into a single array?

Answer : Delphi  Is there a simple way to Concat two Dynamic Arrays in to one Array?

using and testing:

procedure TForm1.Button1Click(Sender: TObject);
var
  StrArray1, StrArray2, ResArray: TStringArray;
begin
  SetLength( StrArray1, 3);
  StrArray1[0]:= 'Str 13';
  StrArray1[1]:= 'Str 12';
  StrArray1[2]:= 'Str 11';

  SetLength( StrArray2, 3);
  StrArray2[0]:= 'Str 23';
  StrArray2[1]:= 'Str 22';
  StrArray2[2]:= 'Str 21';

  ResArray:= ConcatArrays( StrArray1, StrArray2 );

  ShowMessage( ResArray[3] );
end;
Random Solutions  
 
programming4us programming4us