Here you can find the source of getFileNameNoExtensionFromPath(String modulePath)
Parameter | Description |
---|---|
modulePath | a parameter |
public static String getFileNameNoExtensionFromPath(String modulePath)
//package com.java2s; //License from project: Open Source License import java.nio.file.Path; import java.nio.file.Paths; public class Main { /**/* w w w.j a v a2 s . c om*/ * Gets the name of the module, minus the windows file extension if on Windows * @param modulePath * @return the test module name */ public static String getFileNameNoExtensionFromPath(String modulePath) { Path path = Paths.get(modulePath); String fileNameNoPath = path.getFileName().toString(); String fileNameNoExtension = fileNameNoPath; int extIdx = 0; if ((extIdx = fileNameNoPath.lastIndexOf(".")) != -1) { fileNameNoExtension = fileNameNoPath.substring(0, extIdx + 1); } return fileNameNoExtension; } }