Java Path File Name nio getNamePart(Path file)

Here you can find the source of getNamePart(Path file)

Description

get Name Part

License

Open Source License

Declaration

public static String getNamePart(Path file) 

Method Source Code

//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);
    }
}

Related

  1. getName(Path file)
  2. getName(Path path)
  3. getName(Path path)
  4. getName(Path path)
  5. getName(String path)
  6. getNameWithoutSuffix(Path path)
  7. getNormalizedFileName(Path file)
  8. getPackageURI(String pkgName, String pkgPath, String currentPkgName)
  9. getPath(Class example, String filename)