函数,该函数以数字顺序设置文件夹列表,然后按创建日期的顺序返回该列表。
4_Lemur_Jason_20250814_Text
3_Lemur_Jason_20221025_Text
6_Lemur_Jason_20200510_Text
=
第一列按数字顺序排列
3_Lemur_Jason_20221025_Text
4_Lemur_Jason_20250814_Text
6_Lemur_Jason_20200510_Text
=
创建日期的第二个列表
6_Lemur_Jason_20200510_Text
3_Lemur_Jason_20221025_Text
4_Lemur_Jason_20250814_Text
发布于 2022-04-07 23:44:20
我不太清楚整个问题是在问什么,尽管我相信您可以使用这样的方法来获取/排序文件名中的数字:
Scanner fileScanner = new Scanner(new File("its location"));
// create first/default
int smallest = Integer.parseInt(
fileScanner.nextLine().substring(0, 1));
while(fileScanner.hasNextLine())
{
// reads only the digit
int next = Integer.parseInt(
fileScanner.nextLine().substring(0, 1));
// replaces the digit if it's smaller
smallest = (smallest > next) ? next : smallest;
}强调这不是一个完整的解决方案,因为我不太清楚你要求的是什么。
https://stackoverflow.com/questions/71789988
复制相似问题