I am trying to parse a string in a way that is probably uncommon. I can't find the answer anywhere online. This string involves the directory path of the uploaded picture in the ImageView. Directory string have multiple "/" characters in them. How do I tell the app to look at the last "/" character in the string? Here is an example...
Directory Location of the Uploaded Image in the ImageView...
/storage/emulated/0/My Pictures/My family photo.png
I want to split that string to only show My family photo
. The folders and the dot extension I want removed. Only the file name should be displayed.
I've tried this...
String s = getAbsolutePath; //This contains the full string location in my example above.
String[] split1 = s.split("/");
String newS = split1[1];
String[] split2 = newS.split(".png");
String titleString = split2[0];
titleString
should now contain this data string My family photo.
But the result output is actually storage
So now, how do I code this to tell the app look at the last /
in the string just before the filename?
I appreciate the help! Thanks a bunch!!!