How to detect which elements in an array have duplicates
Greetings folks! Lets say I have an array which has duplicates of some elements (This is intentional). How might I go about reporting which of those elements do occur more than once in the array?
Example: Lets say I have an array with the following strings as elements:
Then, in blueprint, I compare that array to the input [Cat], and desire an output of 'True' (or alternatively an integer of the # of occurrences would be fine too). Using the input of [Dog] should yield the output 'False' (or integer 1).
Anyone know how I could achieve this?
Can´t you achive the exact thing you are asking for by a simple counter? If the counter is 1 then there are no duplicates. (false) 2 or more would imply duplicates. (true) 0 is of course not found in array. (error message?)
I guess you would want to reset counter to 0 at starting the function.
answered Mar 14 '16 at 01:00 PM
Well I came up with a solution that accomplishes this, but it's messy. If anyone knows an easier way I'd love to hear it.
Arrays in this image:
answered Mar 14 '16 at 07:21 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here