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) {
        String ext = null;//from ww w .  j a v a  2  s .  com
        String str = f.getName();
        int ind = str.lastIndexOf('.');

        if (ind > 0 && ind < str.length() - 1) {
            ext = str.substring(ind + 1).toLowerCase();
        }
        return ext;
    }
}

Related

  1. getFileExtension(File f)
  2. getFileExtension(File f)
  3. getFileExtension(File f)
  4. getFileExtension(File f)
  5. getFileExtension(File f)
  6. getFileExtension(File file)
  7. getFileExtension(File file)
  8. getFileExtension(File file)
  9. getFileExtension(File file)