diff --git a/common/include/utf8string.hpp b/common/include/utf8string.hpp index 42fe5d438ca4327099bec706d85cc6ac8b84b262..2a7400ea6101711e7a17c91351299f805b00938d 100644 --- a/common/include/utf8string.hpp +++ b/common/include/utf8string.hpp @@ -29,6 +29,7 @@ class utf8string : public std::vector<utf8char> utf8string & operator=(const std::string & other); utf8string & operator=(const char * const other); bool operator==(const std::string & other); + void replace(utf8char from, utf8char to); }; }; diff --git a/common/src/utf8string.cpp b/common/src/utf8string.cpp index d4301975992b133f815304ca098d47c8c69f03e8..42755db464d4625c241a3d262e93aac17b3226a3 100644 --- a/common/src/utf8string.cpp +++ b/common/src/utf8string.cpp @@ -70,3 +70,8 @@ bool util::utf8string::operator==(const std::string & other) return true; } +void util::utf8string::replace(utf8char from, utf8char to) +{ + std::replace(begin(), end(), from, to); +} + diff --git a/reading_machine/src/BaseConfig.cpp b/reading_machine/src/BaseConfig.cpp index 696d76c7277431cf644b0012394c735ec6784d8f..f3a1ed9b833a6a9f1c222c978802044842e89e48 100644 --- a/reading_machine/src/BaseConfig.cpp +++ b/reading_machine/src/BaseConfig.cpp @@ -49,6 +49,8 @@ void BaseConfig::readRawInput(std::string_view rawFilename) std::fclose(file); rawInputUtf8 = util::splitAsUtf8(rawInputTemp); + rawInputUtf8.replace(util::utf8char("\n"), util::utf8char(" ")); + rawInputUtf8.replace(util::utf8char("\t"), util::utf8char(" ")); } void BaseConfig::readTSVInput(std::string_view tsvFilename)