public static int indexOfLastSeparator(String filename){
  if (filename == null) {
    return -1;
  }
  int lastUnixPos=filename.lastIndexOf(UNIX_SEPARATOR);
  int lastWindowsPos=filename.lastIndexOf(WINDOWS_SEPARATOR);
  return Math.max(lastUnixPos,lastWindowsPos);
}

public static int indexOfLastSeparator ( String filename ) { if ( filename == null ) { return - 1 ; } int lastUnixPos = filename . lastIndexOf ( UNIX_SEPARATOR ) ; int lastWindowsPos = filename . lastIndexOf ( WINDOWS_SEPARATOR ) ; return Math . max ( lastUnixPos , lastWindowsPos ) ; }
returns the index of the last directory separator character . < p > this method will handle a file in either unix or windows format . the position of the last forward or backslash is returned . < p > the output will be the same irrespective of the machine that the code is running on .
