read csv file with java - comma delimiter in text field

前端 未结 4 1345
逝去的感伤
逝去的感伤 2020-12-22 10:29

I have a comma separated CSV file contains NASDAQ symbols . I use Scanner to read a file

  s = new Scanner(new File(\"C:\\\\nasdaq_companylist.csv\")).useD         


        
4条回答
  •  天命终不由人
    2020-12-22 11:14

    Your safest bet is you use csv parsing library. Your comma is enclosed in quotes. You'd need to implement logic to look for quoted commas. However you'd also need to plan for other situations, like quote within a quote, escape sequences etc. Better use some ready for use and tested solution. Use google, you'll find some. CSV files can be tricky to use on your own.

提交回复
热议问题