Android File Extension Name Get getFileExtension(String filename, String defExt)

Here you can find the source of getFileExtension(String filename, String defExt)

Description

get File Extension

License

Apache License

Declaration

static public String getFileExtension(String filename, String defExt) 

Method Source Code

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

public class Main {
    static public String getFileExtension(String filename) {
        return getFileExtension(filename, "");
    }// www. j  ava2s .co  m

    static public String getFileExtension(String filename, String defExt) {
        if (filename == null || filename.length() == 0)
            return defExt;
        int pos = filename.lastIndexOf('.');
        if (pos >= 0) {
            return filename.substring(pos + 1);
        }
        return defExt;
    }
}

Related

  1. getFileExt(String fileFullName)
  2. getFileExtByFileName(String fileName)
  3. getFileExtension(String file)
  4. getFileExtension(String fileName)
  5. getFileExtension(String filename)
  6. getFileExtensionFromName(String filename)
  7. getFileExtensionFromSource(byte[] picHeader)
  8. getFileExtensionFromUrl(String url)
  9. getFilenameExtension(String path)