Hello,
I'am reading a CSV file with a "," seperator.
The problem is that when i have a string with a space in it, it splits
By the way i put my data in a jtable by a defaulttablemodel.
What is wrong in my code?
public CsvR() { String path = System.getProperty("user.dir") + "/src/reader.csv"; try { Scanner inputStream = new Scanner(new File(path)); String line = null; while(inputStream.hasNext()) { line = inputStream.next(); String[] value = line.split(","); model.addRow(value); System.out.println(value[0]); } } catch (FileNotFoundException e) { e.printStackTrace(); } JPanel panel = new JPanel(); panel.add(new JScrollPane(table)); this.getContentPane().add(panel); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.pack(); this.setVisible(true); }