Extract file extension: Difference between revisions
Content added Content deleted
m (add CL) |
No edit summary |
||
Line 1,295: | Line 1,295: | ||
/etc/pam.d/login -> ""</pre> |
/etc/pam.d/login -> ""</pre> |
||
=={{header|Nanoquery}}== |
|||
The File object type in Nanoquery has a built-in method to extract the file extension from a filename, but it treats all characters as potentially valid in an extension and URLs as not being. As a result, the .txt_backup extension is included in the output. |
|||
<lang Nanoquery>import Nanoquery.IO |
|||
filenames = {"http://example.com/download.tar.gz", "CharacterModel.3DS"\ |
|||
".desktop", "document", "document.txt_backup", "/etc/pam.d/login"} |
|||
for fname in filenames |
|||
println new(File, fname).getExtension() |
|||
end</lang> |
|||
{{out}} |
|||
<pre>.gz |
|||
.3DS |
|||
.desktop |
|||
.txt_backup |
|||
</pre> |
|||
=={{header|Objeck}}== |
=={{header|Objeck}}== |