提取文件的扩展名
String ext = musicLocal.substring(musicLocal.lastIndexOf("."));
//得到"."最后出现的位置
musicLocal.lastIndexOf(".")
String id = "123454321";
String shortId, longId, Id;
shortId = id.substring(2, 7);
longId = id.substring(1, 8);
Id = id.substring(4);
System.out.println(shortId);
System.out.println(longId);
System.out.println(Id);

substring(x)是从字符串的的第x个字符截取到最后
substring(x,y)是从x到y前的位置停止
最后
以上就是平淡白羊最近收集整理的关于java提取文件的扩展名的全部内容,更多相关java提取文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复