Return array index by searching for single struct element?

Hi - I want to know if it’s possible to use FIND or CONTAINS (Arrays) but perform the test against just one struct element.

Here’s my case - I have a struct which holds Q and A data:

UniqueID (String)
QuestionString (String)
AnswerStrings (StringArray)
AnswerPaths (StringArray)

I’ve got an array of this type of struct which holds a hundred or so questions. Is there a way to find the index of the array item by just the UniqueID string? If I use FIND or CONTAINS I need to supply a whole struct to test against rather than just the element i’m checking for.

I know I can do this with a loop and i’ve done it tons of times before, but there must be a more elegant way of doing it?


The more elegant methods are FindByPredicate(), ContainsByPredicate() and the likes of those, but as far as I know they aren’t exposed to BP, so you’d have to use C++ to take advantage of it.

Cool - i’m no stranger to painfully forcing a function out with a blueprint library - i’m pretty rubbish at c++ but I get there in the end. I’ll post my source here if I get it to work. Thanks Xenome - it’s often a case of just knowing the lingo - ‘predicate’ - to get started on something like this.


Indeed. Shouldn’t be hard to expose this for a specific case when you already know what type of data you’re going to be looking for. Good luck!