来自魔法纪录中文Wiki
跳转至: 导航 搜索

{{{1}}}

文档图示 模板文档[查看] [编辑] [历史] [清除]

参数

{{Replace|字符串|替换原文|替换为|count=替换次数}}

将字符串填入模板参数1,输出时每出现一个参数2的指定原文,就会被替换为参数3的文字,可以用count参数限制替换次数(不指定则全部替换)。前三个参数对所有空格敏感。

范例

  • {{replace|One two two three two four twotwo five|two|NINE}} → One NINE NINE three NINE four NINENINE five
  • {{replace|One two two three two four twotwo five|two|NINE|count=2}} → One NINE NINE three two four twotwo five

空格

  • {{replace|One-two two-three two-four twotwo-five|-|—}} → One—two two—three two—four twotwo—five
  • {{replace|One-two two-three two-four twotwo-five|- |—}} → One-two two-three two-four twotwo-five

参见