What is a good way to process multiple possible string variations into an integer?

Cestarian
Wed, 15 May 2024 10:29:05 +0000
Programming & Scripting

I have an array from which I select skeletal meshes, and I have extracted those skeletal meshes’ names as strings, and what I’d like to do is when that string contains one of several possible substrings, i want things to happen based on which exact substring was found.

The array has some duplicate meshes with slight variations, which is why I want to select the anim blueprint + one or two more execs based on which base model is being used according to the array, hence the idea to use substrings.

However I ran into a problem, substring checks can only output booleans, and most functions that accept booleans only accept one. I’d rather not create a spaghetti of branches, so what should I do?

This is where i’m at, as an example I have two substring processors up there but like I said, I’m a bit lost on what comes next.

My idea was to set the Model index variable to determine what happens in the multigate based on which substring is detected but I cannot think of any actually nice way to do that (although i can think of one or two really nasty ways)

The ideal solution would be a switch node that could select it’s output based on the substrings directly, however as far as I know switch only supports complete strings.

7 posts - 3 participants