Jump to content

Template:Replace/doc

From SeptemWiki
Revision as of 17:12, 9 April 2016 by Shawn (talk | contribs) (Created page with "===Usage=== <code>{{((}}replace|''string''|''target''|''replacement''[|count=''n'']}}</code> Returns ''string'' with the first ''n'' occurrences of ''target'' replaced with '...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Usage

Template:((replace|string|target|replacement[|count=n]}}

Returns string with the first n occurrences of target replaced with replacement. Omitting Template:Code will replace all occurrences. Space counts as a character if placed in any of the first three parameters.

Examples

  • {{replace|One two two three two four twotwo five|two|NINE}}Script error: No such module "String".
  • {{replace|One two two three two four twotwo five|two|NINE|count=2}}Script error: No such module "String".

Space

  • {{replace|One-two two-three two-four twotwo-five|-|—}}Script error: No such module "String".
  • {{replace|One-two two-three two-four twotwo-five|- |—}}Script error: No such module "String".

See also

  • Template:Tl, which replaces only the first occurrence of a string.


Template:String-handling templates