How to get the file-extension from a file?
Posted on 1998-12-19
What is the best way to get the file-extension from a filename?
I have made some code myself, but it is not perfect.
E.g. If I run "Autoexec.bat" through the code, it returns ".bat".
And if I pass "MyFile", I get ".".
It even works if I pass "A.File. with.periods.txt", then I get ".txt"
But the code is not fast enough, because I use a do until-loop function
to get the last period when the filename has got more the one.
So if someone could give me some fast code or a fast api to fix this...