codesnap.nvim/lua/codesnap/utils/string.lua

16 lines
288 B
Lua
Raw Normal View History

2024-02-13 06:05:36 +00:00
local string_util = {}
function string_util.trim(str)
return str:gsub("%s+", "")
end
function string_util.escape(str)
return str:gsub("[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%1")
end
function string_util.ends_with(str, suffix)
return str:sub(-#suffix) == suffix
end
return string_util