Template:Replace

From Homecoming Wiki
Revision as of 09:27, 28 November 2021 by Michiyo (historical) (talk) (Created page with "<includeonly>{{#invoke:String|replace|source={{{1}}}|{{{2}}}|{{{3}}}|count={{{count|}}}|plain={{yesno|{{{regex|no}}}|yes=0|no=1}}}}</includeonly><noinclude> {{documentation}}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
[edit] [purge] Documentation

Template:Languages

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> [[Category:Templates{{#translation:}}]]