Here you can find the source of getFileNameIndexFromPath(String filePathName)
public static int getFileNameIndexFromPath(String filePathName)
//package com.java2s; //License from project: Apache License public class Main { public static int getFileNameIndexFromPath(String filePathName) { if (filePathName.toLowerCase().lastIndexOf("/") > -1) { return filePathName.toLowerCase().lastIndexOf("/"); } else {/*from w w w . j a va 2s. c om*/ return filePathName.toLowerCase().lastIndexOf("\\"); } } }