Hi everybody,
I have an array of letter for example:
VB Code:
string strings[] = { "a", "b", "c", "d", "e"};
I want to generate all possible combinations of a specific length which is determined by the user, for example when he selects 3:
aaa
aab
aac
aad
aae
aba
abb
abc
abd
abe
abd
aca
acb
acc
acd
ace
etc...
I started by this code but it's limited to the length I assume before the runtime
VB Code:
foreach (string l1 in strings) { foreach (string l2 in strings) { foreach (string l3 in strings) { myword = l1 + l2 + l3; } } }
can you think of any solution that works with any length selected by the user at runtime?
Thanks




Reply With Quote