jeudi 2 avril 2015

Removing a part of a string before second /

I have following string:



String path="/folder1/folder2/folder3/";


I want to remove the first path of the String, so that it becomes:



String path="/folder2/folder3/";


So, what I basically need is to know the index of second backslash and I can use subString method then.


In order to know the 2nd position of /, I can run a for loop and check every character.


But I think there must be a better solution. I want to improve my code knowledge. Any help will be highly appreciated.


Aucun commentaire:

Enregistrer un commentaire