I have a string:
/abc/def/ghfj.doc
I would like to extract ghfj.doc from this, i.e. the substring after the last /, or first / from right.
ghfj.doc
/
Could someone please provide some help?
String example = "/abc/def/ghfj.doc"; System.out.println(example.substring(example.lastIndexOf("/") + 1));
2.1m questions
2.1m answers
60 comments
57.0k users