How do I get the last character of a string?
public class Main {
public static void main(String[] args) {
String s = "test string";
//char lastChar = ???
}
}
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.
Could someone please provide some help?