Jump to content

Template:Str rep/doc: Difference between revisions

From SeptemWiki
Created page with "{{metatemplate}} === Usage === <nowiki> {{Str rep|<string>|<find>|<replacewith>}} </nowiki> Returns <string> with the '''first''' occurrence of <find> replaced with <replace..."
 
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


=== Usage ===
=== Usage ===
<nowiki> {{Str rep|<string>|<find>|<replacewith>}} </nowiki>
<nowiki> {{Str rep|haystack|needle|pin}} </nowiki>


Returns <string> with the '''first''' occurrence of <find> replaced with <replacewith>.
Returns ''haystack'' with the '''first''' occurrence of ''needle'' replaced with ''pin''.


=== Example ===
=== Example ===
Line 10: Line 10:


=== See also ===
=== See also ===
* {{tn|Replace}} - to replace ''all'' occurrences (Lua based)
* [[Template:Replace|{{tn|Replace}}]] - to replace ''all'' occurrences (Lua based)

Latest revision as of 17:11, 9 April 2016


Usage

{{Str rep|haystack|needle|pin}}

Returns haystack with the first occurrence of needle replaced with pin.

Example

  • {{str rep|Dogs chase cats|chase|love}} = Script error: No such module "String".

See also

  • [[Template:Replace|Template:Tn]] - to replace all occurrences (Lua based)