Difference between revisions of "Template:TrimNamespace"
From AtlasWiki
(Created page with "<noinclude> This template is designed to trim off the namespace from a string, for example, "XCSG:Foo" will be trimmed to "Foo". Note that this template just looks for a colo...") |
|||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | This template is designed to trim off the namespace from a string, for example, "XCSG:Foo" will be trimmed to "Foo". | + | This template is designed to trim off the namespace from a string, for example, "XCSG:Foo" will be trimmed to "Foo". If no colon is present (or, for technical reasons, if the string starts or ends with a colon and has no colon in the middle of the string), it returns the original string. |
Note that this template just looks for a colon and returns what comes after the colon; page names that themselves include colons may cause undesirable results. | Note that this template just looks for a colon and returns what comes after the colon; page names that themselves include colons may cause undesirable results. | ||
− | </noinclude>{{#arraydefine:x|{{{1}}}|:|}}{{#arrayindex:x|1}} | + | </noinclude>{{#arraydefine:x|{{{1}}}|:|}}{{#arrayindex:x|1|{{{1}}}}} |
Latest revision as of 15:51, 21 April 2014
This template is designed to trim off the namespace from a string, for example, "XCSG:Foo" will be trimmed to "Foo". If no colon is present (or, for technical reasons, if the string starts or ends with a colon and has no colon in the middle of the string), it returns the original string.
Note that this template just looks for a colon and returns what comes after the colon; page names that themselves include colons may cause undesirable results. {{{1}}}