Android File Path Get getPathLastIndex(String fileName, int fromIndex)

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

Description

get Path Last Index

Declaration

public static int getPathLastIndex(String fileName, int fromIndex) 

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  ww .j a v a  2s  .  co  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)
  4. getRoot(File file)