Difference between revisions of "Stripref"

From Sega Retro

(Created page with "<includeonly>{{clearvar|striprefresult}}{{#loop: subchar | 0 | {{#len:{{{1}}}}} | {{#if: {{#pos:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-1234567890|{{#sub:{{{1}}}|...")
 
Line 2: Line 2:
 
| 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>This template removes references from a string.
 
}}{{#var:striprefresult}}</includeonly><noinclude>This template removes references from a string.
  

Revision as of 13:05, 18 July 2018

This template removes references from a string.

Usage

{{stripref|123{{ref|http://segaretro.org}}}}

returns:

123CategoryBadexternalreference


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.