Here you can find the source of getFileNameWithoutExtension(File file)
Parameter | Description |
---|---|
file | File to extract name from |
public static String getFileNameWithoutExtension(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**//from ww w . j a v a 2s . c om * Returns name of specified file without its extension. * @param file File to extract name from * @return name of File */ public static String getFileNameWithoutExtension(File file) { if (file == null) { return null; } String path = file.getName(); int dotAt = path.lastIndexOf('.'); if (dotAt < 0) { return null; } return path.substring(0, dotAt); } }