Java File Extension Name Remove dropExtensions(String FileName)

Here you can find the source of dropExtensions(String FileName)

Description

remove all extensions even if more then one

License

Apache License

Parameter

Parameter Description
FileName a parameter

Declaration

public static String dropExtensions(String FileName) 

Method Source Code

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

public class Main {
    /**/*from ww w. j ava  2  s .com*/
     * remove all extensions even if more then one
     *
     * @param FileName
     * @return
     */
    public static String dropExtensions(String FileName) {
        int index = FileName.lastIndexOf(".");
        while (index > -1) {
            FileName = FileName.substring(0, index);
            index = FileName.lastIndexOf(".");
        }
        return (FileName);
    }
}

Related

  1. dropExtension(final String fileName)
  2. dropExtension(String filename)
  3. dropExtension(String inputFile)