Java File Extension Name Get getFileExtension(File file)

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

Description

get File Extension

License

Open Source License

Declaration

public static String getFileExtension(File file) 

Method Source Code

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

import java.io.*;

public class Main {
    public static String getFileExtension(File file) {
        String extension = file.getAbsolutePath().substring(
                file.getAbsolutePath().lastIndexOf('.') + 1);
        return extension;
    }/*w  ww . j  a v a2s. c o  m*/

    public static String getFileExtension(String str) {
        String extension = str.substring(str.lastIndexOf('.') + 1);
        return extension;
    }
}

Related

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