Java Utililty Methods File Extension Name Remove

List of utility methods to do File Extension Name Remove

Description

The list of methods to do File Extension Name Remove are organized into topic(s).

Method

StringdropExtension(final String fileName)
drop Extension
final int index = fileName.lastIndexOf('.');
if (index < 0) {
    return fileName;
} else {
    return fileName.substring(0, index);
StringdropExtension(String filename)
drop Extension
int index = -1;
if ((index = filename.lastIndexOf('.')) < 0) {
    return filename;
} else {
    return filename.substring(0, index);
StringdropExtension(String inputFile)
dropExtension.
if (inputFile.contains(".")) {
    return inputFile.substring(0, inputFile.lastIndexOf("."));
} else {
    return inputFile;
StringdropExtensions(String FileName)
remove all extensions even if more then one
int index = FileName.lastIndexOf(".");
while (index > -1) {
    FileName = FileName.substring(0, index);
    index = FileName.lastIndexOf(".");
return (FileName);