Link to home
Start Free TrialLog in
Avatar of johnnyg123
johnnyg123Flag for United States of America

asked on

List of possible combinations

I am trying to write some vb.net code that will list all possible combnations of a lst of words.

Currently, I'm interested in the non repeating combination of 4 words "brand", "kind", "size" and "weight".  order is not important.

for example,

I would like to see

brand
brand,kind
brand,kind,size
brand,kind,size,weight

etc

by non repeating I mean for example that
if brand,kind is listed i do not want to see kind,brand

Any ideas???

ASKER CERTIFIED SOLUTION
Avatar of rettiseert
rettiseert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kyle Abrahams, PMP
None repeating is easy:

Load them into an array.

Loop through the array, appending the next word in.

Ex:

            Dim x As String() = "r,t".Split(",")

            Dim s As String
            s = ""
            For i As Integer = 0 To x.Length
                s = s + x(i)
                'output S
            Next