How to fix this Code. I cant get the right code to deliver the string to split and connect to convert union set into binary
The A u B is the process combining the Set A and Set B which the result handle by txtunion.Text.
question 1: how and who i will submit to Split method?
Next is the Split method. Where to split the Union Set ("1,2,3,4,5") String value into array {"1","2","3","4","5"}
question 2: how and who i will submit to convert method?
'A U B'If cbnum.Text="A"And cbope.Text="∪"And cbdem.Text="B"Then txtunion.Visible=True lblU1.Text="A" lblU2.Text="∪" lblU3.Text="B =" lblUnion.Visible=True'Union.'Dim owns_either AsNewHashSet(OfString)(A) owns_either.UnionWith(B) txtunion.Text=String.Join(", ", owns_either.ToArray())EndIf'--------------------------------------------------------------------------------- 'SplitDimunionAsString= txtunion.TextDim split AsString()=union.Split(New[Char](){","c," "c})ForEach s AsStringIn splitIf s.Trim()<>""ThenConsole.WriteLine(s)EndIfNext s'---------------------------------------------------------------------------------''convert union set to binary'Dim dec AsNewHashSet(OfString)From{2,4,5,6,9}Dim bin AsLong=0ForEach i In dec bin = bin Or(1L<<(i -1))Next'Result' txtbinary.Text=String.Concat(Convert.ToString(bin,2).Reverse())