Actions

Template

Difference between revisions of "Stripref"

From Sonic Retro

(Created page with "<includeonly>{{clearvar|striprefresult}}{{#loop: subchar | 0 | {{#len:{{{1}}}}} | {{#if: {{#pos:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-1234567890,._/()'"|{{#sub:...")
 
Line 1: Line 1:
 
<includeonly>{{clearvar|striprefresult}}{{#loop: subchar
 
<includeonly>{{clearvar|striprefresult}}{{#loop: subchar
 
| 0
 
| 0
| {{#len:{{{1}}}}}
+
| {{#len:{{{1|}}}}}
| {{#if: {{#pos:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-1234567890,._/()'"|{{#sub:{{{1}}}|{{#var:subchar}}|1}}}} | {{#vardefine:striprefresult|{{#var:striprefresult}}{{#sub:{{{1}}}|{{#var:subchar}}|1}}}} }}
+
| {{#if: {{#pos:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-1234567890,._/()'":;&=|{{#sub:{{{1|}}}|{{#var:subchar}}|1}}}} | {{#vardefine:striprefresult|{{#var:striprefresult}}{{#sub:{{{1|}}}|{{#var:subchar}}|1}}}} }}
 
}}{{#var:striprefresult}}</includeonly><noinclude>{{SegaRetroTemplate}}
 
}}{{#var:striprefresult}}</includeonly><noinclude>{{SegaRetroTemplate}}
  
Line 8: Line 8:
  
 
==Usage==
 
==Usage==
<pre>{{stripref|123{{ref|http://segaretro.org}}}}</pre>
+
<pre>{{stripref|123{{ref|http://sega.jp}}}}</pre>
  
 
returns:
 
returns:
  
{{stripref|123{{ref|http://segaretro.org}}}}
+
{{stripref|123{{ref|http://sega.jp}}}}
  
  

Revision as of 20:53, 13 December 2020

Segaretro-round.svg This template has been manually copied from Sega Retro, specifically Template:Stripref
Technical restrictions prevent this template from being shared across multiple wikis. In the medium term, any changes should be made to the Sega Retro variant first, before manually copying the contents back here. As this is not an automatic process, this version of the template might also be out of date.

This template removes references from a string.

Usage

{{stripref|123{{ref|http://sega.jp}}}}

returns:

123


Warning: Don't repeatedly use for the same string, because each usage is listed in the references section. Instead, store the string to a variable and use that.