![]() |
Generation of Multiple Set Combinations
Liste der Anhänge anzeigen (Anzahl: 1)
Hello,
how to create a generator of all combinations of three array groups. I need all the combinations, always from all three groups. Thank you Sample of the program in the image. |
AW: Generation of Multiple Set Combinations
What exactly do you have problems with? Nested looping over all 3 arrays should be sufficient.
Delphi-Quellcode:
for I := Low(Array1) to High(Array1) do
for J := Low(Array2) to High(Array2) do for K := Low(Array3) to High(Array3) do WriteLn(Format('%s-%s-%s', [Array1[I], Array2[J], Array3[K]])); |
AW: Generation of Multiple Set Combinations
Thank you,
the problem is to load the array array from edit. Code:
Delphi-Quellcode:
Result = A,B,C,D-1,2,3,4,5,6-X1,X2
procedure TFormGenerate.Generate;
var i1,i2,i3 : Integer; array1,array2,array3: array of string; begin array1 := [editArray1.Text]; array2 := [editArray2.Text]; array3 := [editArray3.Text]; for I1 := Low(Array1) to High(Array1) do for I2 := Low(Array2) to High(Array2) do for I3 := Low(Array3) to High(Array3) do Memo1.Lines.Add(Format('%s-%s-%s', [Array1[I1], Array2[I2], Array3[I3]])); end;
Delphi-Quellcode:
Result =
procedure TForm27.Generate;
var i1,i2,i3 : Integer; array1,array2,array3: array of string; begin array1 := ['A','B']; array2 := ['1','2','3']; array3 := ['X1','X2']; for I1 := Low(Array1) to High(Array1) do for I2 := Low(Array2) to High(Array2) do for I3 := Low(Array3) to High(Array3) do Memo1.Lines.Add(Format('%s-%s-%s', [Array1[I1], Array2[I2], Array3[I3]])); end; A-1-X1 A-1-X2 A-2-X1 ... B-2-X2 B-3-X1 B-3-X2 |
AW: Generation of Multiple Set Combinations
You need to split the string, like
Delphi-Quellcode:
var
array1,array2,array3: TArray<string>; begin array1:= string(editArray1.Text).Split([',']); ... |
AW: Generation of Multiple Set Combinations
Zitat:
Thank you very much. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz