模块:String:修订间差异
imported>Xiplus per EP |
imported>Xiplus-abot 小 已保护“Module:String”:高風險模板:2398431引用<!-- 機器人3 -->([编辑=仅允许管理员](无限期)[移动=仅允许管理员](无限期)) |
||
| (未显示2个用户的3个中间版本) | |||
| 第472行: | 第472行: | ||
end | end | ||
return result; | return result; | ||
end | |||
--[[ | |||
join | |||
Join all non empty arguments together; the first argument is the separator. | |||
Usage: | |||
{{#invoke:String|join|sep|one|two|three}} | |||
]] | |||
function str.join(frame) | |||
local args = {} | |||
local sep | |||
for _, v in ipairs( frame.args ) do | |||
if sep then | |||
if v ~= '' then | |||
table.insert(args, v) | |||
end | |||
else | |||
sep = v | |||
end | |||
end | |||
return table.concat( args, sep or '' ) | |||
end | end | ||