Template:Replace

From Moegirlpedia
(Redirected from Template:Str replace)
Jump to: navigation, search

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