File pathFile = new File(path);
//文件以及路径是否存在
if (!pathFile.exists()) {
//mkdirs可以创建指定目录以及所有的父目录,不存在则创建
pathFile.mkdirs();
}
substring(参数)是java中截取字符串的一个方法
只定字符串最后出现的位置,从0开始:
System.out.println("abcde".lastIndexOf("c")); 输出2
System.out.println("abcdec".lastIndexOf("c")); 输出5