Java CSV/CSV文件中的Delete列 [英] Java- CSV / Delete column in csv file

查看:243
本文介绍了Java CSV/CSV文件中的Delete列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在Java中删除csv文件中的列.

I try to delete a column in csv file in Java.

例如,我有这个csv文件

for example, I have this csv file

ID   name1   name2   name3
1    hello   hell    hel
2    try     tr      t
3    browser bro     br

我想要下一个操作之后:(删除csvFile,2)它将是:

and I want the after the next operation: (delete csvFile, 2) it will be:

ID   name1   name3
1    hello   hel
2    try     t
3    browser br

我发现只有对行而不是列的操作.

I found only operations that invlove rows and not column.

推荐答案

删除CSV文件中一列的唯一方法是删除整个文件中的标题和该列的信息,即针对其中的每一行.文件.即使您使用第三方库,它也会在内部执行此操作.

The only way to delete a column in a CSV file is to remove the header and the information of this column in the whole file, that is for each row of the file. Even if you use a third party library it will do this internally.

这篇关于Java CSV/CSV文件中的Delete列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆