Java File Name Extract extractFileNameFromPath(final String filePath, char separatorChar)

Here you can find the source of extractFileNameFromPath(final String filePath, char separatorChar)

Description

extract File Name From Path

License

Open Source License

Declaration

public static String extractFileNameFromPath(final String filePath, char separatorChar) 

Method Source Code

//package com.java2s;
/*//from www.ja v a 2 s.c  o  m
 * Copyright 2001-2008 Aqris Software AS. All rights reserved.
 * 
 * This program is dual-licensed under both the Common Development
 * and Distribution License ("CDDL") and the GNU General Public
 * License ("GPL"). You may elect to use one or the other of these
 * licenses.
 */

public class Main {
    public static String extractFileNameFromPath(final String filePath, char separatorChar) {
        int index = filePath.lastIndexOf(separatorChar);
        if (index < 0) {
            return filePath;
        }
        return filePath.substring(index + 1);
    }
}

Related

  1. extractFileName(String path)
  2. extractFilename(String path)
  3. extractFileName(String url)
  4. extractFileNameFromBAMLocation(String location)
  5. extractFileNameFromContentDisposition(String contentDisposition)
  6. extractFileNameFromPath(final String path)
  7. extractFilenameFromPath(String path)
  8. extractFilenameFromURL(String url)
  9. extractFileNameFromUrl(String url)