Extract file extension: Difference between revisions
Content deleted Content added
→{{header|Perl 6}}: replace the solution with a simpler one, and mention the built-in ".extension" method |
→Task: some more re-wording, and explicitly restrict to ASCII letters and numbers |
||
Line 1:
{{draft task}}
[[wp:Filename extension|Filename extensions]] are a rudimentary but commonly used way of identifying files types.
{{task heading}}
Line 5 ⟶ 7:
Write a function or program that
* takes one string argument representing the path/URL to a file
* returns the
If your programming language (or standard library) has built-in functionality for extracting a filename extension, show how it would be used, and clearly state how its behavior differs from this specification.
For the purposes of this task, a filename extension
▲{{task heading|Details}}
* occurs at the very end of the filename
* consists of a period, followed by one or more ASCII letters or numbers
{{task heading|Test cases}}
Line 42 ⟶ 49:
| <code>file.odd_one</code>
| <code></code>
| ''empty string,
|}
|