Java File Extension Name Get getFileExtension(String file)

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

Description

get File Extension

License

Open Source License

Declaration

public static String getFileExtension(String file) 

Method Source Code


//package com.java2s;
import java.io.File;

public class Main {
    public static String getFileExtension(String file) {
        return getFileExtension(new File(file));
    }//from w w w  .j  av a  2 s  . c o  m

    public static String getFileExtension(File file) {
        String s = file.toString();
        return s.substring(s.lastIndexOf(".") + 1, s.length());
    }
}

Related

  1. getFileExtension(final File aFile)
  2. getFileExtension(final File file)
  3. getFileExtension(final File file)
  4. getFileExtension(final String file)
  5. getFileExtension(final String fullName)
  6. getFileExtension(String fileName)
  7. getFileExtension(String fileName)
  8. getFileExtension(String filename)
  9. getFileExtension(String filename)