From 26a095533dfac790f4b01b3e39086257caf6cdc2 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 2 May 2023 10:50:25 +0200 Subject: Remove line of code that checks if the row ends with a comma I removed the line because, the last columns can be empty. Splitting the string having a row like this: str1;str2; give us an array of strings like this: [0] => "str1" [1] => "str2" [2] => "" --- src/main/java/it/alessandroiezzi/csv/CSVUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/it/alessandroiezzi/csv/CSVUtils.java b/src/main/java/it/alessandroiezzi/csv/CSVUtils.java index 4f74030..d11a81b 100644 --- a/src/main/java/it/alessandroiezzi/csv/CSVUtils.java +++ b/src/main/java/it/alessandroiezzi/csv/CSVUtils.java @@ -15,6 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + package it.alessandroiezzi.csv; import java.io.BufferedReader; @@ -50,7 +51,6 @@ public class CSVUtils { // Procede a leggere i dati while ((line = br.readLine()) != null) { - line = line.endsWith(COMMA_DELIMITER) ? line.substring(0, line.length() - 1) : line; String[] values = line.replace("\"", "").split(COMMA_DELIMITER, -1); Map data = new HashMap<>(); -- cgit v1.2.3