importing a csv file into a java swing table

后端 未结 3 659
一生所求
一生所求 2021-01-17 02:34

I have a csv file of all the stock quotes on in the nyse. first column is symbol second column is the name of the company.

I have a search box and table made in netb

相关标签:
3条回答
  • 2021-01-17 02:43

    I collect csv data for stocks from Yahoo, and, oddly enough, every now and then they mess it up by using a company name with a comma in it, e.g., "Dolby, Inc.". Of course, that throws off the parsing of the CSV file. I don't know if this might be your problem.

    John Doner

    0 讨论(0)
  • 2021-01-17 02:44

    Try CSVManager.

    0 讨论(0)
  • 2021-01-17 03:00
        package recommendation.event.test;
    
        import java.io.FileReader;
        import com.csvreader.CsvReader;
        public class ReadCSV {
        public static void main (String [] args){
        try {
    
    
            CsvReader products = new CsvReader("resources/Event Recommendation Engine Challenge/data/test.csv");
    
            products.readHeaders();
    
            while (products.readRecord())
            {
                String user = products.get("user");
                String event = products.get("event");
                String invited = products.get("invited");
                String timestamp = products.get("timestamp");
    
                System.out.println(user + " : " + event+" : "+invited+" : "+timestamp);
            }
    
            products.close();
        }catch (Exception e) {
            // TODO: handle exception
        }
    
            }
        }
    
    0 讨论(0)
提交回复
热议问题