mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-22 07:13:45 +01:00
Add text.contains
This commit is contained in:
parent
825599f2d0
commit
9d29f42b4c
4
text.lua
4
text.lua
@ -13,6 +13,10 @@ function starts_with(text, prefix) return text:sub(1, #prefix) == prefix end
|
|||||||
|
|
||||||
function ends_with(text, suffix) return text:sub(-#suffix) == suffix end
|
function ends_with(text, suffix) return text:sub(-#suffix) == suffix end
|
||||||
|
|
||||||
|
function contains(str, substr, plain)
|
||||||
|
return not not str:find(substr, 1, plain == nil and true or plain)
|
||||||
|
end
|
||||||
|
|
||||||
function trim(text, to_remove)
|
function trim(text, to_remove)
|
||||||
local j = 1
|
local j = 1
|
||||||
for i = 1, string.len(text) do
|
for i = 1, string.len(text) do
|
||||||
|
Loading…
Reference in New Issue
Block a user