Parsing CSV in java

后端 未结 9 1869
臣服心动
臣服心动 2020-11-27 21:12

I have this weird situation where I have to read horizontally. So I am getting a csv file which has data in horizontal format. Like below:

CompanyName,RunDat         


        
9条回答
  •  感动是毒
    2020-11-27 22:00

    A CSV file is a \n terminated file that each column can be seperated either by:

    • Comma or
    • Tabs \t

    I suggest that you have a BufferedReader that reads the CSV file and use the readLine() method to read the row.

    From each row, use String.split(arg) where arg will be your comma or tab \t to have an array of columns....from there, you know what to do.

提交回复
热议问题