string.usearch(str, substring, [start])
Search an UTF8 string for the first occurence of a substring, using plain text (no patterns). Faster than string.ufind()
Parameters
str
The string to search.
substr
The sub-string to to search for.
start
An optional number indicating where to start the search. Its default value is 1 and can be negative.
Return value
If the function finds a match, it returns two number : the character position where this occurrence starts and ends. If the sub-string has not been found, it returns nil.
Example
local text = "The sun will shine again !"
-- outputs 9 and 12
print(text:usearch("will"))