Difference between revisions of "Template:Replace"
(Created page with "{{#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}}}<noinclude> {{Documentation}}Category:string manipulation templates </noinclude>") |
m (公的驱逐舰 moved page Template:Str replace to Template:Replace: incorrect name) |
(No difference)
|
Revision as of 00:25, 15 February 2020
{{{1}}}
This template was originally from Template:Replace in Chinese Wikipedia, used here under CC BY-SA 3.0; the names of contributors can be found here.
Parameters and usage
{{replace|string|replace|replace with|count=time to replace}}
Provide the string to parameter 1
, and every instance of the parameter 2
will be replaced by on instance of the parameter 3
. These parameters are all sensitive to spaces.
You may limit how many times replacements are performed with the parameter count
. If count
is not provided, the template will replace very instance found.
Example
{{replace|One two two three two four twotwo five|two|@}}
→ One @ @ three @ four @@ five{{replace|One two two three two four twotwo five|two|@|count=2}}
→ One @ @ three two four twotwo five- To remove something, replace with with empty string:
{{replace|One two two three two four twotwo five|two|}}
→ One three four five
space sensitivity
{{replace|One-two two-three two-four twotwo-five space- six|-|@}}
→ One@two two@three two@four twotwo@five space@ six{{replace|One-two two-three two-four twotwo-five space- six|- |@}}
→ One-two two-three two-four twotwo-five space@six