5
我應用了一個函數,但看起來很糟糕。有沒有模式的Lua string.find
function find_without_pattern(s1,s2)
for i =1,#s1-#s2+1 do
local t = string.sub(s1,i,#s2+i-1)
if t == s2 then
return i,i+#s2-1
end
end
end
不錯,原來我做了不必要的工作。自從我刪除了我之後,我也編輯了你的答案。 –