diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java index a85722f..b1b25d9 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Spreadsheet.java @@ -1,8 +1,11 @@ package de.hs_mannheim.informatik.spreadsheet; +import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -79,7 +82,23 @@ public class Spreadsheet { * @throws IOException If path does not exist. */ public void readCsv(String path, char separator, String startCellName) throws FileNotFoundException { - // TODO: implement this + Scanner sc = new Scanner(new File(path)); + ArrayList memList = new ArrayList<>(); + + while (sc.hasNextLine()) { + memList.add(sc.nextLine()); + } + + String[][] memArr = new String[memList.size()][]; + for(int i = 0; i < memList.size(); i++) + memArr[i] = (memList.get(i)).split(String.valueOf(separator)); + + for (int r = getRow(startCellName); r < memList.size(); r++) + for (int c = getCol(startCellName); c < memList.get(0).length(); c++) + if(c