summaryrefslogtreecommitdiff
path: root/louloulibs/utils/string.cpp
blob: 7ed1aa3ae815d34260759001bedda4700a927e8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <utils/string.hpp>

bool to_bool(const std::string& val)
{
  return (val == "1" || val == "true");
}

std::vector<std::string> cut(const std::string& val, const std::size_t size)
{
  std::vector<std::string> res;
  std::string::size_type pos = 0;
  while (pos < val.size())
    {
      res.emplace_back(val.substr(pos, size));
      pos += size;
    }
  return res;
}