Here you can find the source of getNamePart(Path file)
public static String getNamePart(Path file)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; public class Main { public static String getNamePart(Path file) { String s = file.getFileName().toString(); return getNamePart(s); }/*w ww .j a v a2 s. com*/ public static String getNamePart(String filename) { int i = filename.lastIndexOf('.'); if (i == -1) { return filename; } return filename.substring(0, i); } }