Prev: Warning message with proprietary class
Next: How to get the file name from a String containing the path plus the file name?
From: www on 4 Mar 2010 15:06 Hi, I have a String "dirA/dirB/dirC/file.txt". How to use String manipulation technique to get "file.txt"? String fullName = "dirA/dirB/dirC/file.txt"; int index = fullName.lastIndexOf("\\"); //here is a problem, if I try lastIndexOf("\"), there is a compile error String fileName = fullName.subString(index); //but does not work Thank you very much. ps: I am working on linux. |