diff options
author | 2023-05-02 10:50:25 +0200 | |
---|---|---|
committer | 2023-05-02 10:50:25 +0200 | |
commit | 26a095533dfac790f4b01b3e39086257caf6cdc2 (patch) | |
tree | 8a6d31d4b10dca76ef1131fa9a000fc0377bd7bd | |
parent | 14cc2f02f58e200949ea70d06dc198be3092afb0 (diff) | |
download | csv-utils-26a095533dfac790f4b01b3e39086257caf6cdc2.tar.gz csv-utils-26a095533dfac790f4b01b3e39086257caf6cdc2.zip |
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] => ""
-rw-r--r-- | src/main/java/it/alessandroiezzi/csv/CSVUtils.java | 2 |
1 files changed, 1 insertions, 1 deletions
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 <https://www.gnu.org/licenses/>. */ + 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<String, String> data = new HashMap<>(); |