Java File Extension Name Get getFileExtension(File file)

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

Description

get File Extension

License

LGPL

Declaration

public static final String getFileExtension(File file) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.File;

public class Main {
    public static final String getFileExtension(File file) {
        String fileName = file.getAbsolutePath();
        String ext = (fileName.lastIndexOf(".") == -1) ? ""
                : fileName.substring(fileName.lastIndexOf(".") + 1,
                        fileName.length());
        return ext;
    }/*from   w w  w .  j  a va  2s  . c o  m*/
}

Related

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