How to search a string for key words

Does anyone know of a way to check a string value (Or Keywords) for another string value

Example :
I want to Look for the Word : Dog
String to search for Dog : HelloHowIsYourDog?IHeardHimBarkingYesterday

8 Likes
2 Likes

You can use the string.find() function, where the first parameter is the string you want to search and the second parameter is the keyword you want to find.

Example:

if string.find("HelloHowIsYourDog?IHeardHimBarkingYesterday", "Dog") then
   print("I found dog in the string!")
end
34 Likes