Here you can find the source of getFileWithoutEnding(String absolutePath)
public static String getFileWithoutEnding(String absolutePath)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { public static String getFileWithoutEnding(File f) { return getFileWithoutEnding(f.getAbsolutePath()); }/* w w w .j av a2s. c o m*/ public static String getFileWithoutEnding(String absolutePath) { return separateFileNameFromEnding(getFile(absolutePath)); } public static String separateFileNameFromEnding(File f) { String name = f.getName(); if (name.contains(".")) { return name.substring(0, name.lastIndexOf('.')); } return name; } public static String separateFileNameFromEnding(String file) { if (file.contains(".")) { return file.substring(0, file.lastIndexOf('.')); } return file; } public static String getFile(File f) { return getFile(f.getAbsolutePath()); } public static String getFile(String absolutePath) { if (absolutePath.endsWith(File.separator)) { return ""; } return absolutePath.substring(absolutePath.lastIndexOf(File.separator) + 1, absolutePath.length()); } }