Classify values in array of string

good programmers
I have a problem, I want to classify the data of various arrays, this is the example, the variables are changing

var dog = “dog”
var cat = “cat”
var fish = “fish”

array of string setString = {dog, cat, fish}

horse var = “horse”
var pig = “pig”
var falcon = “”

array of string set2 = {horse, pig, falcon}

I want to detect which array is complete and store it in a different variable, in the same way with those that are incomplete save them in another variable

I don’t want the arrays to be repeated when saving them in the variables

these arrays will pass continuously through a for each

I hope you can help me


this is an example, this is an example, but it doesn’t come out

define a list to add array1 and array2
you can determines if the array is repeated by list1.indexof(value)

1 Like

@Blossomhong
Excuse me and what would I value, I try to make your proposal but I do not get the results I want

@borismh
for this type of comparing collections the set operations Intersect and Except are helpfully:
https://www.tutorialsteacher.com/linq/linq-set-operators-intersect
https://www.tutorialsteacher.com/linq/linq-set-operators-except

combined with a count differences can be detected

Another working apporach is ALL/Any
https://www.tutorialsteacher.com/linq/linq-quantifier-operators
like arr1.Any(Function (x) arr2.Contains(x)) - will check if all arr1 items are contained in arr2

So give a start on this different approaches and let us know your feedback on this

2 Likes

two arrays add to List.
if value not in list. add in.
Parameters ==> Value is where put your array item.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.