Difference between revisions of "Template:Str rep"

From Second Life Wiki
Jump to navigation Jump to search
(Shamelessly copied from mediawiki.org)
 
(Shamelessly copied from wikipedia.org, but a different version)
 
Line 1: Line 1:
{{str left|{{{1}}}|{{#expr: {{str find|{{{1}}}|{{{2}}}}} - 1}}}}{{{3}}}{{str right|{{{1}}}|{{#expr: {{str find|{{{1}}}|{{{2}}}}} + {{str len|{{{2}}}}} - 1}}}}<!--
{{{{{|safesubst:}}}str left|{{{1}}}|{{{{{|safesubst:}}}#expr: {{{{{|safesubst:}}}str find|{{{1}}}|{{{2}}}}} - 1}}}}{{{3}}}{{{{{|safesubst:}}}str right|{{{1}}}|{{{{{|safesubst:}}}#expr: {{{{{|safesubst:}}}str find|{{{1}}}|{{{2}}}}} + {{{{{|safesubst:}}}str len|{{{2}}}}} - 1}}}}<noinclude>
--><noinclude>
 
{{Documentation}}
{{Documentation}}
</noinclude>
</noinclude>

Latest revision as of 02:16, 16 September 2022

{{{3}}}

  • {{{1}}*
  • {{{1}}}*
[Edit] [🔄Purge] Template-info.png Template documentation

Usage

{{Str rep|string|find|replacewith}}

Returns string with the first occurrence of find replaced with replacewith. Equivalent to {{#invoke:String|replace}}.

Example

  • {{str rep|Dogs chase cats. Cats chase mice.|chase|love}} = love
  • Dogs*
  • Dogs *
  • Dogs c*
  • Dogs ch*
  • Dogs cha*
  • Dogs chas*
  • Dogs chase*
  • Dogs chase *
  • Dogs chase c*
  • Dogs chase ca*
  • Dogs chase cat*
  • Dogs chase cats*
  • Dogs chase cats.*
  • Dogs chase cats. *
  • Dogs chase cats. *
  • Dogs chase cats. C*
  • Dogs chase cats. Ca*
  • Dogs chase cats. Cat*
  • Dogs chase cats. Cats*
  • Dogs chase cats. Cats *
  • Dogs chase cats. Cats c*
  • Dogs chase cats. Cats ch*
  • Dogs chase cats. Cats cha*
  • Dogs chase cats. Cats chas*
  • Dogs chase cats. Cats chase*
  • Dogs chase cats. Cats chase *
  • Dogs chase cats. Cats chase m*
  • Dogs chase cats. Cats chase mi*
  • Dogs chase cats. Cats chase mic*
  • Dogs chase cats. Cats chase mice*
  • Dogs chase cats. Cats chase mice.*

See also

  • {{Replace}} - to replace all occurrences (or a specific number)

Template:String-handling templates