~singpolyma/biboumi

ref: 1028d4d549b517c5b42bb0c30a410d1ab43c4cf3 biboumi/src/utils/split.cpp -rw-r--r-- 418 bytes
1028d4d5 — Florent Le Coz Add a changelog entry for the fixed_irc_server option 7 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <utils/split.hpp>

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