I have a string variable in Java with the value below:
String str = "web > data > list > new_list.html";
I want my final string like so:
String str = "new_list.html";
I have tried like this:
final Pattern pattern = Pattern.compile("[\\>.]");
final String[] result = pattern.split(str);
But it is returning data > list > new_list.html
How can i get exact substring new_list.html
?
String s = "web > data > list > new_list.html";
String newList = s.substring(s.lastIndexOf("> ") + 2);
Try this:
String str = "web > data > list > new_list.html";
str = str.substring(20);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.