mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-08 10:23:54 +00:00
22 lines
594 B
C++
22 lines
594 B
C++
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
#include "osquery/core.h"
|
|
|
|
#include <boost/algorithm/string/split.hpp>
|
|
#include <boost/algorithm/string/trim.hpp>
|
|
|
|
namespace osquery {
|
|
|
|
std::vector<std::string> split(const std::string& s, const std::string& delim) {
|
|
std::vector<std::string> elems;
|
|
boost::split(elems, s, boost::is_any_of(delim));
|
|
auto start = std::remove_if(
|
|
elems.begin(), elems.end(), [](const std::string& s) { return s == ""; });
|
|
elems.erase(start, elems.end());
|
|
for (auto& each : elems) {
|
|
boost::algorithm::trim(each);
|
|
}
|
|
return elems;
|
|
}
|
|
}
|