Answers for "get file extension without dot java"

3

java how to read file extension

private static String getFileExtension(File file) {
        String extension = "";
 
        try {
            if (file != null && file.exists()) {
                String name = file.getName();
                extension = name.substring(name.lastIndexOf("."));
            }
        } catch (Exception e) {
            extension = "";
        }
 
        return extension;
 
    }
Posted by: Guest on March-15-2020

Code answers related to "get file extension without dot java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language