1
Fork 0
satellite/home/features/neovim/config/lua/my/helpers/string.lua
2023-12-02 00:59:18 +01: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