Difference between revisions of "Fileext"

From Sega Retro

(Created page with "<includeonly>{{#ifeq:{{#sub:{{{1}}}|{{#len:{{{1}}}}}-4|1}}|.|{{#sub:{{{1}}}|{{#len:{{{1}}}}}-3|3}}|}}</includeonly><noinclude> This template returns the file extension of a fi...")
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq:{{#sub:{{{1}}}|{{#len:{{{1}}}}}-4|1}}|.|{{#sub:{{{1}}}|{{#len:{{{1}}}}}-3|3}}|}}</includeonly><noinclude>
+
<includeonly>{{#if:{{#pos:{{{1|}}}|.}}|{{#explode:{{{1|}}}|.|-1}}}}</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.
  
[[Category:Sega Retro templates|{{PAGENAME}}]]</noinclude>
+
==Examples==
 +
{|class="prettytable"
 +
! Code || Result
 +
|-
 +
|
 +
<pre>{{fileext|Filename.txt}}</pre>
 +
| {{fileext|Filename.txt}}
 +
|-
 +
|
 +
<pre>{{fileext|https://segaretro.org/skins/foreground/assets/img/segaretro_logo.png}}</pre>
 +
| {{fileext|https://segaretro.org/skins/foreground/assets/img/segaretro_logo.png}}
 +
|-
 +
|
 +
<pre>{{fileext|Not a file name}}</pre>
 +
| {{fileext|Not a file name}}
 +
|-
 +
|
 +
<pre>{{fileext|String ending with a stop.}}</pre>
 +
| {{fileext|String ending with a stop.}}
 +
|}
 +
 
 +
[[Category:Templates]]</noinclude>

Latest revision as of 14:15, 1 January 2022

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

Examples

Code Result
{{fileext|Filename.txt}}
txt
{{fileext|https://segaretro.org/skins/foreground/assets/img/segaretro_logo.png}}
png
{{fileext|Not a file name}}
{{fileext|String ending with a stop.}}