mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-08 02:18:53 +00:00
b9f732c31f
As per t5494224, all of the license headers in osquery needed to be updated to reflect the correct open source header style.
30 lines
846 B
C++
30 lines
846 B
C++
/*
|
|
* Copyright (c) 2014, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#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;
|
|
}
|
|
}
|