Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I find a certain word in a whole string?

For example - "I like apples and pie" how can I find "apples" and nothing else of the string?

2 answers

✓ Accepted answer
local str = "Hello World!"

local match = string.match(str, "World!")
-- This would return either "World!" or nil.
local string = "I like apples and pie"
if string:find("apples") then
	--stuff
end

i hope this works

This discussion is preserved as it was. New answers, comments, and votes are closed.