Java Path File Extention nio stripExtension(Path path, String extension)

Here you can find the source of stripExtension(Path path, String extension)

Description

strip Extension

License

Open Source License

Declaration

public static String stripExtension(Path path, String extension) 

Method Source Code


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

import java.nio.file.Path;

public class Main {
    public static String stripExtension(Path path, String extension) {
        String fileName = path.toString();
        return fileName.substring(0, fileName.toLowerCase().indexOf(extension));
    }/* w  w w  . j a  v  a 2  s  . c  o  m*/
}

Related

  1. listFiles(final Path path, final String... extensions)
  2. listFiles(String path, String extension)
  3. removeExtension(final Path path)
  4. removeExtension(Path file)
  5. replaceExtensionWith(String toFilePath, String newExtension)