Modul:String: Unterschied zwischen den Versionen

+ splitAndStrip()
K (Schützte „Modul:String“ ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt)))
(+ splitAndStrip())
Zeile 80: Zeile 80:
-- Removes all spaces at the end of a string
-- Removes all spaces at the end of a string
return s:gsub("%s+$", "")
return s:gsub("%s+$", "")
end
function p.splitAndStrip(s, delimiter)
-- combination of p.split2 and p.strip
    local result = {}
    if not com.isEmpty(s) then
local split = p.split2(s, delimiter)
for _, v in ipairs(split) do
v = p.strip(v)
if v ~= "" then
table.insert(result, v)
end
end
    end
-- mw.logObject(result)
return result
end
end


return p
return p