Say you have multiple strings that you're trying to match in a text. And it's possible all these strings have a match in the text. Is there a good way to return out of all the matching strings the index of the one that comes first? Or a -1 if there are no matching strings whatsoever.
For example, say the text is "The seven dwarves are Grumpy, Dopey, Doc, Happy, Bashful, Sneezy, and Sleepy." Then the code would find the first occurrence out of the dwarf names that do appear in the text. In this case Grumpy is the first time a dwarf name appears which is index 22.