Published
- 1 min read
lua string.find
The solution for this is noted below
lua string.find
Solution
s = "hello world"
i, j = string.find(s, "hello")
print(i, j) --> 1 5
print(string.sub(s, i, j)) --> hello
print(string.find(s, "world")) --> 7 11
i, j = string.find(s, "l")
print(i, j) --> 3 3
print(string.find(s, "lll")) --> nil
Try other methods by searching on the site. That is if this doesn’t work