Here you can find the source of getFileNameNoExt(File file)
Parameter | Description |
---|---|
file | File to remove extension from. |
public static String getFileNameNoExt(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /** Removes extension from file name * @param file {@code File} to remove extension from. * @returns Literal file name without the extension. *//* w ww .j a v a 2 s .c om*/ public static String getFileNameNoExt(File file) { String filename = file.getName(); return filename.substring(0, filename.lastIndexOf(".")); } }