Android File Extension Name Get getFileExtension(String file)

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

Description

get File Extension

Declaration

private static String getFileExtension(String file) 

Method Source Code

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

public class Main {
    private static String getFileExtension(String file) {
        String extension = "";
        String fileName = new File(file).getName();
        int idxOfDot = fileName.lastIndexOf('.');
        if (idxOfDot != -1) {
            extension = fileName.substring(idxOfDot + 1);
        }//  ww w  .  j av  a 2  s  .  c o m
        return extension;
    }
}

Related

  1. getExtension(String filename)
  2. getExtensionName(String fileName)
  3. getFileEx(String filePath)
  4. getFileExt(String fileFullName)
  5. getFileExtByFileName(String fileName)
  6. getFileExtension(String fileName)
  7. getFileExtension(String filename)
  8. getFileExtension(String filename, String defExt)
  9. getFileExtensionFromName(String filename)