最后结果:1479805098158.jpg
String imgUrl = "http://127.0.0.1:8080/cms/ReadAddress/1479805098158.jpg";
String image = imgUrl.substring(imgUrl.lastIndexOf("/")+1);
字符串.substring(字符串.lastIndexOf("\\")+1)
本文介绍了一种从完整图片URL中截取出文件名的方法,通过使用Java字符串操作功能,具体演示了如何定位并获取URL中的图片文件名。
最后结果:1479805098158.jpg
String imgUrl = "http://127.0.0.1:8080/cms/ReadAddress/1479805098158.jpg";
String image = imgUrl.substring(imgUrl.lastIndexOf("/")+1);
字符串.substring(字符串.lastIndexOf("\\")+1)
