2023-07-31 23:42:49 +02:00
|
|
|
#include <algorithm>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
2023-11-05 12:41:10 +01:00
|
|
|
#include "common/string_util.h"
|
2023-07-31 23:42:49 +02:00
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
namespace Common {
|
2023-07-31 23:42:49 +02:00
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
std::vector<std::string> SplitString(const std::string &str, char delimiter) {
|
|
|
|
std::istringstream iss(str);
|
|
|
|
std::vector<std::string> output(1);
|
2023-07-31 23:42:49 +02:00
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
while (std::getline(iss, *output.rbegin(), delimiter)) {
|
|
|
|
output.emplace_back();
|
2023-07-31 23:42:49 +02:00
|
|
|
}
|
2023-11-05 15:56:28 +01:00
|
|
|
|
|
|
|
output.pop_back();
|
|
|
|
return output;
|
2023-07-31 23:42:49 +02:00
|
|
|
}
|
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
} // namespace Common
|