Android File Extension Name Get getFileExtenSion(File file)

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

Description

get File Exten Sion

Declaration

public static String getFileExtenSion(File file) 

Method Source Code

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

import java.util.Locale;

public class Main {

    public static String getFileExtenSion(File file) {
        String ex;/* w w w . j a  v  a  2 s.c  o m*/
        String filename;
        try {
            filename = file.getName();
            ex = filename.substring(filename.lastIndexOf(".") + 1);

        } catch (Exception e) {
            return "";
        }
        return ex.toLowerCase(Locale.getDefault());
    }
}

Related

  1. parseFileExtension(String filename)
  2. parseFileExtension(String filename)
  3. removeExtension(String file)
  4. removeExtension(String s)
  5. getExtension(final String fileName)
  6. getFileExtension(String fullFilename, Boolean withDot)
  7. getFileExtensionOnly(String filename)