Extract file extension: Difference between revisions
Content added Content deleted
m (added related tasks.) |
|||
Line 2,122: | Line 2,122: | ||
"/etc/pam.d/login" -> "" |
"/etc/pam.d/login" -> "" |
||
</pre> |
</pre> |
||
=={{header|Smalltalk}}== |
|||
The Filename class has a convenient suffix method for that; so we convert the string to a filename and ask it: |
|||
<lang smalltalk>names := #( |
|||
'http://example.com/download.tar.gz' |
|||
'CharacterModel.3DS' |
|||
'.desktop' |
|||
'document' |
|||
'document.txt_backup' |
|||
'/etc/pam.d/login' |
|||
). |
|||
names do:[:f | |
|||
'%-35s -> %s\n' printf:{ f . f asFilename suffix } on:Stdout |
|||
]</lang> |
|||
{{out}} |
|||
<pre>http://example.com/download.tar.gz -> gz |
|||
CharacterModel.3DS -> 3DS |
|||
.desktop -> |
|||
document -> |
|||
document.txt_backup -> txt_backup |
|||
/etc/pam.d/login -> </pre> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |