Extract file extension: Difference between revisions

m
→‎{{header|REXX}}: changed comments and whitespace.
(make one test-case use a number and upper-case letter)
m (→‎{{header|REXX}}: changed comments and whitespace.)
Line 1,005:
 
do j=1 while @.j\==''; x= /*process (all of) the file name(s). */
p=lastpos(., @.j) /*find the last position of a period. */
if p\==0 then x=substr(@.j, p+1) /*Found a dot? Then get stuff after it*/
if \datatype(x, 'A') then x= /*is itNot upper/lowercase letters | digits?*/
if x=='' then x= " [null]" /*use a better name for a "null". ext.*/
else x= . || x /*prefix the extension with a period. */
say 'file extension=' left(x, 20) "for file name=" @.j
end /*j*/ /*stick a fork in it, we're all done. */</lang>
'''output''' &nbsp; when using the default (internal) inputs: