Here you can find the source of hasExtensionIgnoreCase(Path path, String ext)
public static boolean hasExtensionIgnoreCase(Path path, String ext)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013, 2014 ETAS GmbH./*from www.j av a 2 s .c om*/ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Dennis Eder (ETAS GmbH) - initial API and implementation and/or initial documentation *******************************************************************************/ import java.nio.file.Path; public class Main { public static boolean hasExtensionIgnoreCase(Path path, String ext) { String name = path.getFileName().toString(); int dot = name.lastIndexOf('.'); String token = name.substring(dot + 1); if (token == null) return false; return token.equalsIgnoreCase(ext); } }