Template:Replace/doc

From Homecoming Wiki
< Template:Replace
Revision as of 09:28, 28 November 2021 by Michiyo (historical) (talk) (Created page with "<includeonly> {{Languages|Template:Replace}} </includeonly>{{Documentation subpage}} {{Lua|Module:String}} <!-- Categories go at the bottom of this page and interwikis go in W...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This is a documentation subpage for Template:Replace (see that page for the template itself).
It contains usage information, categories and other content that is not part of the original template page.

Template:Lua <templatestyles src="Template:Mono/styles.css"/>{{Replace|string|target|replacement[|count=n]}}

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

Examples

  • <templatestyles src="Template:Mono/styles.css"/>{{Replace|One two two three two four twotwo five|two|NINE}} → {{#invoke:String|replace|source=One two two three two four twotwo five|two|NINE|count=|plain=1}}
  • <templatestyles src="Template:Mono/styles.css"/>{{Replace|One two two three two four twotwo five|two|NINE|count=2}} → {{#invoke:String|replace|source=One two two three two four twotwo five|two|NINE|count=2|plain=1}}

TemplateData

<templatedata> { "description": { "en": "This template replaces a substring in a string with a given replacement.", "tr": "Bu şablon, bir dizeyi bir verilen bir değiştirme ile değiştirir." }, "format": "inline", "params": { "1": { "label": { "en": "Source string", "tr": "Kaynak dizesi" }, "description": { "en": "The string to replace in.", "tr": "Değiştirilecek dize." }, "required": true, "type": "string" }, "2": { "label": { "en": "Pattern", "tr": "Desen" }, "description": { "en": "The string or Lua ustring pattern to search for.", "tr": "Aranacak dize veya Lua ustring modeli." }, "required": true, "type": "string" }, "3": { "label": { "en": "Replacement", "tr": "Değiştirme" }, "description": { "en": "The replacement text.", "tr": "Değiştirme metni." }, "required": true, "type": "line" }, "count": { "label": { "en": "Count", "tr": "Sayaç" }, "description": { "en": "The number of occurrences to replace; defaults to all.", "tr": "Değiştirilecek olay sayısı; tümü için varsayılandır." }, "type": "number" }, "regex": { "label": { "en": "Regular expression", "tr": "Düzenli ifade" }, "description": { "en": "Whether the pattern is a Lua ustring pattern (no means search for literally that character sequence).", "tr": "Desenin bir Lua ustring deseni olup olmadığı (bu karakter dizisini kelimenin tam anlamıyla aramak anlamına gelmez)." }, "example": "yes", "type": "boolean", "default": "no" } } } </templatedata>