Java File Extension Name Get fileExt(String url)

Here you can find the source of fileExt(String url)

Description

file Ext

License

Apache License

Declaration

public static String fileExt(String url) 

Method Source Code

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

public class Main {
    public static String fileExt(String url) {
        String ext = url.substring(url.lastIndexOf("."));
        if (ext.contains("?")) {
            ext = ext.substring(0, ext.indexOf("?"));
        }/* w w w.j a va2 s  .co m*/
        if (ext.contains("%")) {
            ext = ext.substring(0, ext.indexOf("%"));
        }
        return ext;
    }
}

Related

  1. extractExtension(String s)
  2. extractExtension(String strFilename)
  3. extractExtension(String url)
  4. extractExtensions(String fileName)
  5. fileExt(String name)
  6. fileExtension(CharSequence path)
  7. fileExtension(String filename)
  8. fileExtension(String path)
  9. getFileExtension(File _file)