Java Path File Name nio getFileName(String path)

Here you can find the source of getFileName(String path)

Description

get File Name

License

Open Source License

Declaration

public static String getFileName(String path) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static String getFileName(String path) {
        Path p = Paths.get(path);
        String fname = p.getFileName().toString();
        int lio = fname.lastIndexOf(".");
        return fname.substring(0, lio);
    }/*from  w ww  . j a v a2 s.c  o m*/
}

Related

  1. getFilename(final Path path)
  2. getFilename(final Path path)
  3. getFileName(Path path)
  4. getFileName(Path path)
  5. getFileName(String fullPath, boolean withParentFolder)
  6. getFileName(String relativePath)
  7. getFileNameFromPath(String filePath)
  8. getFileNameFromPath(String str)
  9. getFilenameOrLastPath(String path)