Android Path Create getNameDelLastPath(String fileName)

Here you can find the source of getNameDelLastPath(String fileName)

Description

get Name Del Last Path

Declaration

public static String getNameDelLastPath(String fileName) 

Method Source Code

//package com.java2s;

public class Main {

    public static String getNameDelLastPath(String fileName) {
        int point = getPathLastIndex(fileName);
        if (point == -1) {
            return fileName;
        } else {/*from ww w .  j a  va2 s .com*/
            return fileName.substring(0, point);
        }
    }

    public static int getPathLastIndex(String fileName) {
        int point = fileName.lastIndexOf('/');
        if (point == -1) {
            point = fileName.lastIndexOf('\\');
        }
        return point;
    }

    public static int getPathLastIndex(String fileName, int fromIndex) {
        int point = fileName.lastIndexOf('/', fromIndex);
        if (point == -1) {
            point = fileName.lastIndexOf('\\', fromIndex);
        }
        return point;
    }
}

Related

  1. getFilePath(String path)
  2. getPath(String fullFileName)
  3. getProjectAbsolutePath()
  4. getUniqueFilePath(String filePath)
  5. getFolderPathNameYearAndMonthSubDirectoryDay()
  6. getPath(String path, String parent)
  7. getRealPath(String name)
  8. getFullPath(String inBaseUrl, String inUrl)
  9. getNameAppendStr(String path, String Str)