Here you can find the source of getFileNameNoExt(String path)
public static String getFileNameNoExt(String path)
//package com.java2s; /*//from ww w . j a v a 2s . co m * Copyright (c) 2006-2012 Nuxeo SA (http://nuxeo.com/) and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Nuxeo - initial API and implementation * */ import java.io.File; public class Main { public static String getFileNameNoExt(String path) { String name = getFileName(path); int p = name.lastIndexOf('.'); if (p == -1) { return name; } return name.substring(0, p); } public static String getFileName(String path) { int p = path.lastIndexOf(File.separator); if (p == -1) { return path; } return path.substring(p + 1); } }