Difference between revisions of "Template:Replace"

From Moegirlpedia
Jump to: navigation, search
Line 1: Line 1:
 
{{#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}}}<noinclude>
 
{{#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}}}<noinclude>
{{Documentation}}[[Category:String manipulation templates]][[Category:Auxiliary templates]]
+
{{Documentation}}[[Category:String manipulation templates]][[Category:Auxiliary templates]][[Category:Functional templates]]
 
</noinclude>
 
</noinclude>

Revision as of 14:37, 2 February 2021

{{{1}}}

Template-info.svg Template Documentation  [View] [Edit] [History] [Refresh]

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