Strings In Depth9 / 14
Up next

Find a substring

-- find returns the start and end index of the match
local s = "hello world"
local i, j = string.find(s, "world")
print(i, j)
-- it returns nil when there is no match
print(string.find(s, "xyz"))
What you're solving

string.find returns match indices