确定是最后一个/后面的么?
字符换你替换下,我贴了可能会被屏蔽
public class $ {
public static void main(String[] args) {
String str = "你的字符串";
int idx = str.lastIndexOf("/");
str = str.substring(idx + 1, str.length());
System.out.println(str);
}
}
结果:
shhkjshj.zip
public static void main(String[] args){
String unSplit = "1,2,3,4,5";
//根据长度取数组的最后一个元素
System.out.println(unSplit.split(",")[unSplit.split(",").length-1]);
}
String str = "123,456,789";
String[] units = str.split(",");
System.out.println(units[units.length-1]);
用lastIndexOf()就可以了 已经有人回答了