MyWikiBiz, Author Your Legacy — Sunday October 20, 2024
Jump to navigationJump to search
340 bytes added
, 07:44, 16 July 2021
local p = {}
function p.stripspaces(str)
return str:gsub("^%s*(.-)%s*$", "%1") -- trim spaces
end
function p.split(str, sep) -- split string by separator and return table
sep = sep or "%s"
local parts = {}
for word in string.gmatch(str, "[^" .. sep .. "]+") do parts[#parts+1] = p.stripspaces(word) end
return parts
end
return p