1
Fork 0
satellite/dotfiles/neovim/lua/my/helpers/string.lua
2023-09-22 19:37:24 +03:00

14 lines
278 B
Lua

local M = {}
function M.split(text, sep)
---@diagnostic disable-next-line: redefined-local
local sep, fields = sep or ":", {}
local pattern = string.format("([^%s]+)", sep)
text:gsub(pattern, function(c)
fields[#fields + 1] = c
end)
return fields
end
return M