Here you can find the source of lastIndexOfPathSeparator(String str)
public static int lastIndexOfPathSeparator(String str)
//package com.java2s; //License from project: Apache License public class Main { public static int lastIndexOfPathSeparator(String str) { if (str == null) return -1; int length = str.length(); for (int i = length - 1; i >= 0; i--) { char c = str.charAt(i); if (c == '/' || c == '\\') { return i; }//from w ww . j a v a2 s . co m } return -1; } }