import org.junit.Test;
public class testClass {
public static void main(String[] args) {
String str="http://i0.hdslb.com/bfs/article/d87bd2dcf2889555d773220018b54d8815f06219.jpg";
String prefix=str.substring(str.lastIndexOf(".")+2);
String prefix1=str.substring(str.lastIndexOf("."));
int la = str.lastIndexOf(".");//返回“.”所在的下标位置
System.out.println(prefix);
}
}
lastIndexOf(".")和substring结合在一起使用
最新推荐文章于 2024-05-17 22:04:11 发布