How to get file extension in java code example
Get file extension in java code example
public static String getFileExtension(String filePath)
{
File f = new File(filePath);
String name = f.getName();
int k = name.lastIndexOf(".");
String ext = null;
if(k != -1)
ext = name.substring(k + 1, name.length());
return ext;
}
public static String getFileExtension(String filePath)
{
File f = new File(filePath);
String name = f.getName();
int k = name.lastIndexOf(".");
String ext = null;
if(k != -1)
ext = name.substring(k + 1, name.length());
return ext;
}
Sir , Bahut acha post hai well sir aap AJAX ke bare post kyo nahi karta.
ReplyDeletePrashant Kumar
Sir, Ek aur baat puchni hai AJAX ka use kar ke "select Country dropdown automatically State name in dropdown & City Name in dropdown.
ReplyDeletePrashant Kumar
But it is also good to check if '.' is last symbol in filename
ReplyDelete