15.082
Bearbeitungen
(p.split2() zu p.split) |
(- p.ilist()) |
||
| Zeile 1: | Zeile 1: | ||
local p = {} | local p = {} | ||
local | local com = require("Module:Common") | ||
function p.replace(s, old, new, count) | function p.replace(s, old, new, count) | ||
| Zeile 39: | Zeile 39: | ||
-- mw.log("split2(" .. (s or "nil") .. ", " .. (delimiter or "nil") .. ")") | -- mw.log("split2(" .. (s or "nil") .. ", " .. (delimiter or "nil") .. ")") | ||
local result = {} | local result = {} | ||
if not | if not com.isEmpty(s) then | ||
result = p.split(s, delimiter) | result = p.split(s, delimiter) | ||
end | end | ||
| Zeile 49: | Zeile 49: | ||
-- converts a keyed table into a list with delimiters | -- converts a keyed table into a list with delimiters | ||
-- the indexes/keys gonna lost and the list may be unsorted | -- the indexes/keys gonna lost and the list may be unsorted | ||
-- it's the counterpart of split() | -- it's the counterpart of p.split() | ||
local list = "" | local list = "" | ||
if not | if not com.isEmpty(table) then | ||
if type(table) == "table" then | if type(table) == "table" then | ||
separator = separator or " " | separator = separator or " " | ||
| Zeile 64: | Zeile 64: | ||
end | end | ||
end | end | ||
return list | return list | ||
end | end | ||