Difference between revisions of "Fileext"

From Sega Retro

(simplified)
Line 1: Line 1:
<includeonly>{{#ifeq:{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-4}}|1}}|.|{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-3}}|3}}|}}{{
+
<includeonly>{{#ifeq:{{{1|}}}|-1||{{#sub:{{{1|}}}|{{#expr:{{#rpos:{{{1|}}}|.}}-{{#len:{{{1|}}}}}+1}}}}}}</includeonly><noinclude>
#ifeq:{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-3}}|1}}|.|{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-2}}|2}}|}}{{
 
#ifeq:{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-5}}|1}}|.|{{#sub:{{{1}}}|{{#expr:{{#len:{{{1}}}}}-4}}|4}}|}}
 
</includeonly><noinclude>
 
 
This template returns the file extension of a file link or url.
 
This template returns the file extension of a file link or url.
 +
 +
==Example==
 +
<tt><nowiki>{{fileext|Filename.txt}}</nowiki></tt>
 +
 +
gives the result:
 +
 +
{{fileext|Filename.txt}}
  
 
[[Category:Sega Retro templates|{{PAGENAME}}]]</noinclude>
 
[[Category:Sega Retro templates|{{PAGENAME}}]]</noinclude>

Revision as of 00:31, 23 January 2015

This template returns the file extension of a file link or url.

Example

{{fileext|Filename.txt}}

gives the result:

txt