From 134d80b4b189ae3821cbef8cfe59c71053eebca4 Mon Sep 17 00:00:00 2001 From: Moritz Winter Date: Mon, 4 Nov 2024 09:33:53 +0100 Subject: [PATCH] Newlines at end of strings are unexpected --- include/DataFrame/Internals/DataFrame_read.tcc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/DataFrame/Internals/DataFrame_read.tcc b/include/DataFrame/Internals/DataFrame_read.tcc index 2348648d..3c47e328 100644 --- a/include/DataFrame/Internals/DataFrame_read.tcc +++ b/include/DataFrame/Internals/DataFrame_read.tcc @@ -1153,6 +1153,12 @@ read_csv2_(std::FILE *stream, } } else if (col_spec.type_spec == "string") { + if (!value.empty() && value.back() == '\n') { + value.pop_back(); + } + if (!value.empty() && value.back() == '\r') { + value.pop_back(); + } std::any_cast &> (col_spec.col_vec).emplace_back(value); }