Module:DateThings: Difference between revisions
Jump to navigation
Jump to search
JoshuaJSlone (talk | contribs) (TEST BEGIN) |
JoshuaJSlone (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
--Copied from https://stackoverflow.com/questions/1426954/split-string-in-lua | |||
function mysplit(inputstr, sep) | |||
if sep == nil then | |||
sep = "%s" | |||
end | |||
local t = {} | |||
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do | |||
table.insert(t, str) | |||
end | |||
return t | |||
end | |||
function p. | |||
function p.datesplit(frame) | |||
InputSeparator = "," | |||
OutputSeparator = "・" | |||
InputText = frame.args[1] | InputText = frame.args[1] | ||
OutputText = Separator .. InputText .. Separator | DateList = mysplit(InputText,",") | ||
OutputText = "" | |||
for i, v in ipairs(a) do | |||
OutputText = OutputText .. DateList[i] .. Separator | |||
end | |||
--OutputText = Separator .. InputText .. Separator | |||
return OutputText | return OutputText | ||
end | end |
Revision as of 21:15, 1 December 2024
Documentation for this module may be created at Module:DateThings/doc
local p = {} --Copied from https://stackoverflow.com/questions/1426954/split-string-in-lua function mysplit(inputstr, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do table.insert(t, str) end return t end function p.datesplit(frame) InputSeparator = "," OutputSeparator = "・" InputText = frame.args[1] DateList = mysplit(InputText,",") OutputText = "" for i, v in ipairs(a) do OutputText = OutputText .. DateList[i] .. Separator end --OutputText = Separator .. InputText .. Separator return OutputText end return p