I need to generate all combinations (not permutations) in VB .NET, I’ve been search and all I found is for permutations (some says combinations but when I was try it, all are permutations).
What I need is to generate combinations from string array:
Dim data_array As String() = {"one", "two", "three", "four", "five", "six"}
I need that:
If I say just 1 length, it must returns:
one
two
three
four
five
six
If I say 2 length, it must returs:
oneone
onetwo
onethree
onefour
... etc ...
twoone
twotwo
twothree
... etc ...
And continues til end with all combinations.
If I say more length do it as well.
You say you want to generate all combinations but it looks to me like to are trying to generate all permutations.
You might try to do it recursively if you wish. If you just want to generate combinations then test the Root parameter to see if it contains myStr before appending it.