Java Path File Name nio getNameWithoutSuffix(Path path)

Here you can find the source of getNameWithoutSuffix(Path path)

Description

get Name Without Suffix

License

Apache License

Declaration

public static String getNameWithoutSuffix(Path path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.file.Path;

public class Main {
    public static String getNameWithoutSuffix(Path path) {
        String name = path.getFileName().toString();
        int index = name.lastIndexOf('.');
        if (index == -1) {
            return name;
        }//from   w w  w. ja  va2s .c  o  m
        return name.substring(0, index);
    }
}

Related

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