Hello,
I have a
String which is holding a file path like(C:\Documents and Settings\bkmal\Desktop\application.pdf)
I need to get only the file name like(application.pdf in the above fielPath).
String filePath = "C:\Documents and Settings\bkmal\Desktop\application.pdf";
String onlyfileName= filePath.substring((filePath.lastIndexOf("/")),filePath.length());
when I do this I get the following exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
what am I doing wrong?? any suggestions