~singpolyma/biboumi

ref: b60cbda4f93bb83e36b29f5cba975b94b833663d biboumi/src/utils/split.hpp -rw-r--r-- 415 bytes
b60cbda4 — Florent Le Coz Read the served hostname from the config file 9 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#ifndef SPLIT_INCLUDED
# define SPLIT_INCLUDED

#include <string>
#include <sstream>
#include <vector>

namespace utils
{
  std::vector<std::string> split(const std::string &s, const char delim)
  {
    std::vector<std::string> ret;
    std::stringstream ss(s);
    std::string item;
    while (std::getline(ss, item, delim))
      ret.emplace_back(std::move(item));
    return ret;
  }
}

#endif // SPLIT_INCLUDED