Skip to content
Snippets Groups Projects
Commit 3922e47f authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

replace boost in Fit/Tool/StringUtil.cpp

parent df87f1f7
No related branches found
No related tags found
1 merge request!2534rm some uses of Boost
This commit is part of merge request !2534. Comments created here will be created in the context of that merge request.
...@@ -13,13 +13,22 @@ ...@@ -13,13 +13,22 @@
// ************************************************************************************************ // ************************************************************************************************
#include "Fit/Tool/StringUtil.h" #include "Fit/Tool/StringUtil.h"
#include <boost/algorithm/string.hpp> #include <algorithm>
#include <ranges>
#include <regex>
//! Returns token vector obtained by splitting string at delimiters. //! Returns token vector obtained by splitting string at delimiters.
std::vector<std::string> mumufit::stringUtil::split(const std::string& text, std::vector<std::string> mumufit::stringUtil::split(const std::string& text,
const std::string& delimiter) const std::string& delimiter)
{ {
std::vector<std::string> tokens; std::vector<std::string> result;
boost::split(tokens, text, boost::is_any_of(delimiter)); size_t pos = 0;
return tokens; 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;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment