Jump to content

Extract file extension: Difference between revisions

no edit summary
m (add CL)
No edit summary
Line 1,295:
/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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.