Java File Name Extract extractFileName(String fullPath)

Here you can find the source of extractFileName(String fullPath)

Description

extract File Name

License

Open Source License

Declaration

public static String extractFileName(String fullPath) 

Method Source Code

//package com.java2s;

public class Main {
    public static String extractFileName(String fullPath) {
        String sep1 = "/";
        String sep2 = "\\";
        if (fullPath.lastIndexOf(sep1) >= 0) {
            return fullPath.substring(fullPath.lastIndexOf(sep1) + 1);
        } else if (fullPath.lastIndexOf(sep2) >= 0) {
            return fullPath.substring(fullPath.lastIndexOf(sep2) + 1);
        }//from w ww  . j  a  v a  2 s .  c  o m
        return fullPath;
    }
}

Related

  1. extractFileName(String file)
  2. extractFileName(String fileName)
  3. extractFileName(String filePathName)
  4. extractFileName(String filePathName)
  5. extractFileName(String fn)
  6. extractFileName(String name)
  7. extractFileName(String path)
  8. extractFileName(String path)
  9. extractFilename(String path)