Friday, February 24, 2017

How to get file extension from a file name

 String fileName = "jasmine.jpeg";
        String fileNameWithoutExtension = fileName.split("\\.")[0];
        String extension = fileName.split("\\.")[1];
        System.out.println("File Name Without Extension:    "+fileNameWithoutExtension);
       System.out.println("Extension:   "+extension);
    

No comments:

Post a Comment