zwfzwfa 2022-03-29 18:32 采纳率: 71.4%
浏览 94
已结题

读取csv文件最后一行数据,然后取出文件名称,下面是CSV文件

在若依框架中
2021/3/22 8:13:21 8:14:25 2DSRT10MCS PD/OTA Production 5333548 1D1140 SPL 47 47 0 NA 202671 amd_5333548_5333548_SPL_2DSRT10MCS_081425.dat OPN Data is not changed

2021/3/22 8:17:55 8:21:30 2DSRT10MCS PD/OTA Production 5333548 1D1140 SPL 83 83 0 NA 202671 amd_5333548_5333548_RUB_2DSRT10MCS_082130.dat OPN Data is not changed
2021/3/22 8:30:55 8:33:29 2DSRT10MCS PD/OTA Production 5333528 1D1140 SPL 79 79 0 NA 202671 amd_5333528_5333528_SPL_2DSRT10MCS_083329.dat OPN Data is not changed
2021/3/22 8:35:30 8:40:12 2DSRT10MCS PD/OTA Production 5333528 1D1140 SPL 81 81 0 NA 202671 amd_5333528_5333528_RUB_2DSRT10MCS_084012.dat OPN Data is not changed
2021/3/22 8:40:54 8:42:19 2DSRT10MCS PD/OTA Production 5324068 1D1140 SPL 11 11 0 NA 202671 amd_5324068_5324068_SPL_2DSRT10MCS_084219.dat OPN Data is not changed
2021/3/22 8:44:32 8:48:14 2DSRT10MCS PD/OTA Production 5324068 1D1140 SPL 149 149 0 NA 202671 amd_5324068_5324068_RUB_2DSRT10MCS_084814.dat OPN Data is not changed
2021/3/22 8:56:48 8:58:10 2DSRT10MCS PD/OTA Production 4643937 1D1140 SPL 20 20 0 NA 202671 amd_4643937_5319631_SPL_2DSRT10MCS_085810.dat OPN Data is not changed
2021/3/22 8:59:55 9:03:27 2DSRT10MCS PD/OTA Production 4643937 1D1140 SPL 2 2 0 NA 202671 amd_4643937_5319631_RUB_2DSRT10MCS_090327.dat OPN Data is not changed
2021/3/22 9:03:43 9:05:13 2DSRT10MCS PD/OTA Production 5333909 1D1140 SPL 38 38 0 NA 202671 amd_5333909_5333909_SPL_2DSRT10MCS_090513.dat OPN Data is not changed
2021/3/22 9:07:37 9:12:47 2DSRT10MCS PD/OTA Production 5333909 1D1140 SPL 94 94 0 NA 202671 amd_5333909_5333909_RUB_2DSRT10MCS_091247.dat OPN Data is not changed
2021/3/22 9:24:40 9:26:13 2DSRT10MCS PD/OTA Production 4651647 1D1140 SPL 15 15 0 NA 202671 amd_4651647_5331561_SPL_2DSRT10MCS_092613.dat OPN Data is not changed
2021/3/22 9:27:53 9:30:50 2DSRT10MCS PD/OTA Production 4651647 1D1140 SPL 91 91 0 NA 202671 amd_4651647_5331561_RUB_2DSRT10MCS_093050.dat OPN Data is not changed
2021/3/22 10:15:55 10:17:24 2DSRT10MCS PD/OTA Production 4524110 GF4094 SPL 3 3 0 NA 202671 amd_4524110_5051548_SPL_2DSRT10MCS_101724.dat OPN Data is not changed
2021/3/22 10:19:26 10:23:16 2DSRT10MCS PD/OTA Production 4524110 GF4094 SPL 5 5 0 NA 202671 amd_4524110_5051548_RUB_2DSRT10MCS_102316.dat OPN Data is not changed
2021/3/22 10:36:40 10:38:21 2DSRT10MCS PD/OTA Production 5323087 1D1140 SPL 62 62 0 NA 202671 amd_5323087_5323087_SPL_2DSRT10MCS_103821.dat OPN Data is not changed
2021/3/22 10:40:04 10:43:29 2DSRT10MCS PD/OTA Production 5323087 1D1140 SPL 35 35 0 NA 202671 amd_5323087_5323087_RUB_2DSRT10MCS_104329.dat OPN Data is not changed
2021/3/22 10:44:18 10:46:20 2DSRT10MCS PD/OTA Production 5333968 1D1140 SPL 70 70 0 NA 202671 amd_5333968_5333968_SPL_2DSRT10MCS_104620.dat OPN Data is not changed
2021/3/22 10:48:04 10:50:30 2DSRT10MCS PD/OTA Production 5333968 1D1140 SPL 11 11 0 NA 202671 amd_5333968_5333968_RUB_2DSRT10MCS_105030.dat OPN Data is not changed
2021/3/22 12:11:55 12:14:47 2DSRT10MCS PD/OTA Production 5326638 1D1140 SPL 107 107 0 NA 202671 amd_5326638_5326638_SPL_2DSRT10MCS_121447.dat OPN Data is not changed
2021/3/22 12:17:58 12:21:22 2DSRT10MCS PD/OTA Production 5326638 1D1140 SPL 53 53 0 NA 202671 amd_5326638_5326638_RUB_2DSRT10MCS_122122.dat OPN Data is not changed
2021/3/22 12:21:39 12:24:30 2DSRT10MCS PD/OTA Production 5332386 1D1140 SPL 145 145 0 NA 202671 amd_5332386_5332386_SPL_2DSRT10MCS_122430.dat OPN Data is not changed
2021/3/22 12:26:45 12:29:05 2DSRT10MCS PD/OTA Production 5332386 1D1140 SPL 15 15 0 NA 202671 amd_5332386_5332386_RUB_2DSRT10MCS_122905.dat OPN Data is not changed
2021/3/22 12:33:45 12:35:17 2DSRT10MCS PD/OTA Production 5334105 1D1140 SPL 64 64 0 NA 202671 amd_5334105_5334105_SPL_2DSRT10MCS_123517.dat OPN Data is not changed
2021/3/22 12:37:16 12:40:17 2DSRT10MCS PD/OTA Production 5334105 1D1140 SPL 92 92 0 NA 202671 amd_5334105_5334105_RUB_2DSRT10MCS_124017.dat OPN Data is not changed
2021/3/22 12:41:30 12:43:50 2DSRT10MCS PD/OTA Production 5334327 1D1140 SPL 120 120 0 NA 202671 amd_5334327_5334327_SPL_2DSRT10MCS_124350.dat OPN Data is not changed
2021/3/22 12:45:35 12:48:58 2DSRT10MCS PD/OTA Production 5334327 1D1140 SPL 40 40 0 NA 202671 amd_5334327_5334327_RUB_2DSRT10MCS_124858.dat OPN Data is not changed
2021/3/22 13:05:28 13:08:16 2DSRT10MCS PD/OTA Production 5333978 1D1140 SPL 147 147 0 NA 202671 amd_5333978_5333978_SPL_2DSRT10MCS_130816.dat OPN Data is not changed
2021/3/22 13:10:29 13:13:38 2DSRT10MCS PD/OTA Production 5333978 1D1140 SPL 13 13 0 NA 202671 amd_5333978_5333978_RUB_2DSRT10MCS_131338.dat OPN Data is not changed
2021/3/22 13:14:32 13:16:15 2DSRT10MCS PD/OTA Production 5331309 BN1140 SPL 61 61 0 NA 202671 amd_5331309_5331309_SPL_2DSRT10MCS_131615.dat OPN Data is not changed
2021/3/22 13:18:04 13:21:08 2DSRT10MCS PD/OTA Production 5331309 BN1140 SPL 99 99 0 NA 202671 amd_5331309_5331309_RUB_2DSRT10MCS_132108.dat OPN Data is not changed
2021/3/22 13:22:17 13:24:09 2DSRT10MCS PD/OTA Production 5333237 1D1140 SPL 68 68 0 NA 202671 amd_5333237_5333237_SPL_2DSRT10MCS_132409.dat OPN Data is not changed
2021/3/22 13:25:52 13:31:18 2DSRT10MCS PD/OTA Production 5333237 1D1140 SPL 92 92 0 NA 202671 amd_5333237_5333237_RUB_2DSRT10MCS_133118.dat OPN Data is not changed
2021/3/22 16:09:43 16:12:13 2DSRT10MCS PD/OTA Production 5334307 1D1140 SPL 52 52 0 NA 202671 amd_5334307_5334307_SPL_2DSRT10MCS_161213.dat OPN Data is not changed
2021/3/22 16:14:17 16:19:03 2DSRT10MCS PD/OTA Production 5334307 1D1140 SPL 81 81 0 NA 202671 amd_5334307_5334307_RUB_2DSRT10MCS_161903.dat OPN Data is not changed
2021/3/22 17:40:22 17:42:23 2DSRT10MCS PD/OTA Production 5334892 1D1140 SPL 11 11 0 NA 202671 amd_5334892_5334892_SPL_2DSRT10MCS_174223.dat OPN Data is not changed
2021/3/22 17:44:27 17:48:26 2DSRT10MCS PD/OTA Production 5334892 1D1140 SPL 134 134 0 NA 202671 amd_5334892_5334892_RUB_2DSRT10MCS_174825.dat OPN Data is not changed

运行结果及报错内容
希望把读取数据返回给前端
读取出amd_5334892_5334892_RUB_2DSRT10MCS_174825.da
  • 写回答

4条回答 默认 最新

  • CSDN专家-sinJack 2022-03-29 18:40
    关注
    String fileName="";
    // 创建 reader
    try (BufferedReader br = Files.newBufferedReader(Paths.get("users.csv"))) {
        // CSV文件的分隔符
        String DELIMITER = ",";
        // 按行读取
        String line;
        while ((line = br.readLine()) != null) {
            // 分割
            String[] columns = line.split(DELIMITER);
           fileName=columns[0];
        }
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    System.out.println("最后一行文件名称:"+fileName);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 4月10日
  • 已采纳回答 4月2日
  • 创建了问题 3月29日

悬赏问题

  • ¥15 写一个可直接调用的函数,将32位有符号数转成另一个无符号的数
  • ¥15 CMAKE+VS2019+QT5.15.2组合进行二次编译
  • ¥15 nginx 配置静态html访问 ,后台登录时页面始终被重定向到登录页,无法访问到后台的静态html页
  • ¥20 自动登录的j2ee程序编译
  • ¥15 fluent模拟静态气体扩散
  • ¥15 java根据模板,生成word文档,需要带目录
  • ¥15 广告联盟的兜底广告是什么意思
  • ¥15 如何证明高斯噪声的包络公式
  • ¥150 寻找王者荣耀开发作者,合作或者解答
  • ¥15 关于cpci总线的几个问题,别用人工智能回答