File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
I/O and Streams
How to find the extention of file
Joined: Jan 15, 2001
Nov 02, 2002 11:04:00
Whenever we use a
to get a file it returns a File object.My question is weather it is possible to get the file extension
from the File object.If yes then how?
Joined: Apr 07, 2002
Nov 14, 2002 16:04:00
the extension is the substring beginning with the last dot. For example:
String extension = filename.substring (filename.lastIndexOf(".") + 1, filename.length();
Hope this helps.
Joined: Nov 14, 2002
Nov 14, 2002 22:24:00
I want to think return .exe?what do me??
I agree. Here's the link:
subject: How to find the extention of file
getting a file name
non-networked and network mode
how to get the web link of uploaded file on web server?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014