Jump to content

Extract file extension: Difference between revisions

m
added whitespace before the TOC (table of contents), split two long sentences.
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations.)
m (added whitespace before the TOC (table of contents), split two long sentences.)
Line 1:
{{draft task}}
 
Write a program that takes one string argument representing the path to a file and returns the file's extension, or the null string if the file path has no extension. An extension appears after the last period in the file name and consists of one or more letters or numbers.
 
An extension appears after the last period in the file name and consists of one or more letters or numbers.
 
Show here the action of your routine on the following examples:
Line 11 ⟶ 13:
# /path/to.my/file returns an empty string as the period is in the directory name rather than the file
# file.odd_one returns an empty string as an extension (by this definition), cannot contain an underscore.
<br><br>
 
 
=={{header|ALGOL 68}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.