-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCSVHandler.pde
46 lines (40 loc) · 874 Bytes
/
CSVHandler.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* @author LuisMQuinones
* @modified November 22, 2020
*
* Need to handle exception better
*/
import java.io.FileReader;
class CSVHandler {
String pathToCSV;
BufferedReader reader;
FileReader fReader;
public CSVHandler(String path) {
pathToCSV = path;
try {
fReader = new FileReader(pathToCSV);
reader = new BufferedReader(fReader);
}
catch(Exception e) {
println("FileNotFound");
}
}
//returns "" when last entry is empty
String[] getLastRow() {
// String [] lastRow = new String[9];
String row="";
String last="";
try {
while ((row = reader.readLine()) != null)
{
last=row;
}
//lastRow = last.split(",");
}
catch(Exception e) {
println("Something went wrong"+e);
println(pathToCSV);
}
return last.split(",");
}
}