Module:AeroWikiListTools: Difference between revisions
From Aeronautica Official Wiki
More actions
Sqwishyish (talk | contribs) m Added comma detection for the end of the string. |
Sqwishyish (talk | contribs) m added whitespaces between commas |
||
Line 21: | Line 21: | ||
for split in string.gmatch(input_string , '([^,]+)') do | for split in string.gmatch(input_string , '([^,]+)') do | ||
new_string = new_string .. template:gsub('{split}', split:match('^%s*(.-)%s*$')) | new_string = new_string .. template:gsub('{split}', split:match('^%s*(.-)%s*$')) .. ' ' | ||
end | end | ||
if template:sub(-1) == ',' then | if template:sub(-1) == ',' then | ||
new_string = new_string:sub(1, - | new_string = new_string:sub(1, -3) | ||
elseif template:sub(-2) == ', ' then | elseif template:sub(-2) == ', ' then | ||
new_string = new_string:sub(1, - | new_string = new_string:sub(1, -4) | ||
end | end | ||