跳转到内容

模板:Replace

轻之舟百科,让知识轻装启航

{{{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
上述文档内容嵌入自Template:Replace/doc。(编辑 | 历史)
编者可以在本模板的沙盒(创建 | 镜像)和测试样例(创建)页面进行实验。
请将模板自身所属的分类添加在文档中。本模板的子页面。