Android File Path Get getPathLastIndex(String fileName)

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

Description

get Path Last Index

Declaration

public static int getPathLastIndex(String fileName) 

Method Source Code

//package com.java2s;

public class Main {

    public static int getPathLastIndex(String fileName) {
        int point = fileName.lastIndexOf('/');
        if (point == -1) {
            point = fileName.lastIndexOf('\\');
        }//from  w  w  w. ja  v a  2  s .  c  o  m
        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. getCanonicalFile(File file)
  2. getDrive(File file)
  3. getPathLastIndex(String fileName, int fromIndex)
  4. getRoot(File file)