How to search a word in a string?

Hey i’m wondering how to detect a word in a string. Example : i want to know if the word Apple is in the string : “Apple is good to eat” and it return true.
Thanks if you can help me!

This is where string patterns come into play.

Use this example found in the above page to find the word:

local match = string.match("Welcome to Roblox!", "Roblox")
print(match)

In your case, it will be:

local match = string.match("Apple is good to eat", "Apple")
print(match)
1 Like