Newbie here with a question. I have the following .csv file as an example:
10;06.07.2022;This is test;
08;01.07.2020;This is test;
15;06.07.2021;This is test;
09;06.07.2021;This is test;
So its multiple rows with the same setup. I want to delete each row which have a date earlier then 06.07.2022. So in theory only the first row should still be in the .csv file and the other ones should get deleted.
I want to be able to declare the date as a variable. I already did the following to try to understand:
private String dateii = 'test.csv'; // Filename Input
private String dateio = ''; // Filename Output
void openInputfile() {
File outputfile = new File(dateio);
outputfile.write('');
File inputfile = new File(dateii);
if (!inputfile.exists()) {
println("No File")
}
List data = inputfile.readLines();
for (String zeile in data) {
if (zeile.startsWith('BEREICH')) {
Header = zeile;
} else {
List buffer = zeile.split(";");
if (zeile.size() > 0) { // Remove Empty rows
}
}
}
EDIT:
So my questions are the following:
- How can I delete a complete row?
- How can I specify which rows to delete using the date?
Thank you!