模板:Replace

来自决策链云智库
Zeroclanzhang讨论 | 贡献2023年7月21日 (五) 20:39的版本 (创建页面,内容为“<includeonly>{{#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}|plain={{yesno|{{{regex|no}}}|yes=0|no=1}}}}</includeonly><noinclude>{{/doc}}</noinclude>”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
Usage

{{replace |<string >|<target >|<replacement>|<count>}}

Returns string with the first n occurrences of target replaced with replacement. Omitting count will replace all occurrences.

Examples
  • {{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