From 222eca4f999591c3960e4acb13b94a249d1002b5 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Thu, 2 May 2024 11:04:59 +0200 Subject: [PATCH] ditto for Base::String::split --- Base/Util/StringUtil.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Base/Util/StringUtil.cpp b/Base/Util/StringUtil.cpp index 5c4272d0c3a..2bd483cd26b 100644 --- a/Base/Util/StringUtil.cpp +++ b/Base/Util/StringUtil.cpp @@ -22,10 +22,15 @@ //! Returns token vector obtained by splitting string at delimiters. std::vector<std::string> Base::String::split(const std::string& text, const std::string& delimiter) { - if (text.empty()) - return {}; std::vector<std::string> result; - boost::split(result, text, boost::is_any_of(delimiter)); + size_t pos = 0; + while (pos != std::string::npos) { + size_t next_pos = text.find(delimiter, pos); + result.push_back(text.substr(pos, next_pos - pos)); + if (next_pos == std::string::npos) + break; + pos = next_pos + delimiter.length(); + } return result; } -- GitLab