delphi – Concatenate Array x Vectors

Question:

I have the following values ​​in a StringList:

 1111,2222
 3333,4444

I have another String list with values

 7777,8888
 9999,0000

I need to add the values ​​from the second stringlist, concatenating in the same position in sequence as the first Example:

 1111,2222,7777,8888
 3333,4444,9999,0000

How do I add the contents of the second array of data to the first?

Answer:

You will have to obtain beforehand which is the Largest list, I mean, the one with the greatest amount of data, otherwise there will be violation or List of Bounds.

  for i := 0 to Pred(vLista1.Count) do
  begin
    vLista1.Strings[i] := vLista1.Strings[i] + ',' + vLista2.Strings[i];
  end;

In this way we are editing the First List with the Second's data in exactly the same order as the data.

Scroll to Top