Here you can find the source of getFileNameWithoutExtension(String fullFilename)
Parameter | Description |
---|---|
fullFilename | file name with extension. |
public static String getFileNameWithoutExtension(String fullFilename)
//package com.java2s; // License as published by the Free Software Foundation; either import java.io.File; public class Main { /**//from w w w .j av a2 s. com * Returns file name without extension. * We do not use the method from Guava library to reduce Checkstyle's dependencies * on external libraries. * @param fullFilename file name with extension. * @return file name without extension. */ public static String getFileNameWithoutExtension(String fullFilename) { final String fileName = new File(fullFilename).getName(); final int dotIndex = fileName.lastIndexOf('.'); final String fileNameWithoutExtension; if (dotIndex == -1) { fileNameWithoutExtension = fileName; } else { fileNameWithoutExtension = fileName.substring(0, dotIndex); } return fileNameWithoutExtension; } }