Template:Replace/doc

From Linux Web Expert

Revision as of 12:11, 21 September 2022 by imported>ENeRZet (text editing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

  • {{Replace|One two two three two four twotwo five|two|NINE}} → One NINE NINE three NINE four NINENINE five
  • {{Replace|One two two three two four twotwo five|two|NINE|count=2}} → One NINE NINE three two four twotwo five

TemplateData

<templatedata> { "description": { "en": "This template replaces a substring in a string with a given replacement.", "cs": "Tato šablona nahradí podřetězec v řetězci danou náhradou.", "tr": "Bu şablon, bir dizeyi bir verilen bir değiştirme ile değiştirir." }, "format": "inline", "params": { "1": { "label": { "en": "Source string", "cs": "Zdrojový řetězec", "tr": "Kaynak dizesi" }, "description": { "en": "The string to replace in.", "cs": "Řetězec, který se má nahradit.", "tr": "Değiştirilecek dize." }, "required": true, "type": "string" }, "2": { "label": { "en": "Pattern", "cs": "Vzor", "tr": "Desen" }, "description": { "en": "The string or Lua ustring pattern to search for.", "cs": "Řetězec nebo vzor ustring Lua k vyhledání.", "tr": "Aranacak dize veya Lua ustring modeli." }, "required": true, "type": "string" }, "3": { "label": { "en": "Replacement", "cs": "Výměna, nahrazení", "tr": "Değiştirme" }, "description": { "en": "The replacement text.", "cs": "Náhradní text.", "tr": "Değiştirme metni." }, "required": true, "type": "line" }, "count": { "label": { "en": "Count", "cs": "Počet", "tr": "Sayaç" }, "description": { "en": "The number of occurrences to replace; defaults to all.", "cs": "Počet výskytů, které mají být nahrazeny. Výchozí pro všechny.", "tr": "Değiştirilecek olay sayısı; tümü için varsayılandır." }, "type": "number" }, "regex": { "label": { "en": "Regular expression", "cs": "regulární výraz", "tr": "Düzenli ifade" }, "description": { "en": "Whether the pattern is a Lua ustring pattern (no means search for literally that character sequence).", "cs": "Zda je vzor vzorem Lua ustring (žádné doslovné hledání řetězce znaků).", "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>