Java File Extension Name Get getFileExtension(File f)

Here you can find the source of getFileExtension(File f)

Description

get File Extension

License

Open Source License

Declaration

public static String getFileExtension(File f) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static String getFileExtension(File f) {
        return getFileExtension(f.getAbsolutePath());
    }//from   w  w  w  .  j a  va2 s.c om

    public static String getFileExtension(String path) {
        try {
            return path.substring(path.lastIndexOf('.') + 1).toLowerCase();
        } catch (Exception e) {
            return null;
        }
    }
}

Related

  1. fileExtension(String filename)
  2. fileExtension(String path)
  3. getFileExtension(File _file)
  4. getFileExtension(File f)
  5. getFileExtension(File f)
  6. getFileExtension(File f)
  7. getFileExtension(File f)
  8. getFileExtension(File f)
  9. getFileExtension(File f)