全站通知:
模块:String
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:String/doc创建
local p = {}
--[[
删除内容中的条带标记
-------------------
* 测试输入:
* 控 制 台 > `mw.log(p['unstrip']({ args={ "123<pre>456</pre>789" } }))`
* wikitext > `{{#invoke:String|unstrip|123<pre>456</pre>789}}`
* 测试输出:
```
* 控 制 台 > 123<pre>456</pre>789
* wikitext > 123789
```
]]
p["unstrip"] = function (frame)
return mw.text.unstrip( frame.args[1] )
end
--[[
替换字符串
-------------------
* 测试输入:
* 控 制 台 > `mw.log(p['replace']({ args={ "123<pre>456</pre>789", 123, 456 } }))`
* wikitext > `{{#invoke:String|replace|123<pre>456</pre>789|123|456}}`
* 测试输出:
```
* 控 制 台 > 123<pre>456</pre>789
* wikitext > 123789
```
]]
p["replace"] = function (frame)
local new_str = string.gsub( frame.args[1], frame.args[2], frame.args[3], frame.args[4] )
return new_str
end
return p