This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Have a look at the API documentation for class java.lang.String. It contains a number of methods to do string processing, for example to find characters like '/' in a string.
Since you're dealing with file paths here, you might want to use class java.io.File for this job instead. It automatically handles the different path delimiter characters that are used on different operating systems (for example, '\' on Windows and '/' on Unix and other OS'es). So, also have a look at the API documentation of class java.io.File.
One alternative along the same lines as what you're thinking is to reverse the String and read up to the first "/". This will separate out the file name and the path to the file. Then just reverse the two resulting Strings to get them back into usable form.
The best way is probably to just use Java's File object to do the work for you.
If you're not yet familiar with using regular expressions in Java, this might be a good time to start learning about them. A decent introduction to this subject is in the two "An Introduction to java.util.regex" articles in the JavaRanch Journal.
Way Big Hint ('cuz you got lucky that I was just now writing a regular expression for something else): [ June 12, 2007: Message edited by: Dirk Schreckmann ]
thanks to everyone who replied here. it was very beneficial for what i needed and then some. Dirk i went with your help here as it worked exactly and i was unaware until now of how to use lazy matching effectively.