Here you can find the source of getFileNameWithoutExt(final Path file)
Parameter | Description |
---|---|
file | file whose name without extension to be returned |
public static String getFileNameWithoutExt(final Path file)
//package com.java2s; //License from project: Apache License import java.nio.file.Path; public class Main { /**/* w w w . ja v a 2s.co m*/ * Returns the file name of the specified file without its extension. * * @param file file whose name without extension to be returned * @return the file name of the specified file without its extension */ public static String getFileNameWithoutExt(final Path file) { final String fileName = file.getFileName().toString(); final int dotIdx = fileName.lastIndexOf('.'); return dotIdx > 0 ? fileName.substring(0, dotIdx) : fileName; } }