Oh. So how do I get the index that's the end of the string?

Is there a way to do a thing called IF the string is found in the variable then execute my code?