Skip to content

Instantly share code, notes, and snippets.

@tdgunes tdgunes/gist:9491925
Created Mar 11, 2014

What would you like to do?
class Untitled {
public static void main(String[] args) {
String absolutePath = "/Hello/AnotherFolder/The File Name.PDF";
File file = new File(absolutePath);
String fname = file.getName();
int pos = fname.lastIndexOf(".");
if (pos > 0) {
fname = fname.substring(0, pos);
String filePath = absolutePath.substring(0,absolutePath.lastIndexOf(File.separator));
filePath = filePath + File.separator;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.