Canoe
Comprehensive Atmosphere N' Ocean Engine
vectorize.cpp
Go to the documentation of this file.
1 // C/C++
2 #include <cstring>
3 #include <string>
4 #include <vector>
5 
6 // utils header
7 #include "vectorize.hpp"
8 
9 template <>
10 std::vector<std::string> Vectorize(const char* cstr, const char* delimiter) {
11  std::vector<std::string> arr;
12  char str[1028], *p;
13  snprintf(str, sizeof(str), "%s", cstr);
14  p = std::strtok(str, delimiter);
15  while (p != NULL) {
16  arr.push_back(p);
17  p = std::strtok(NULL, delimiter);
18  }
19  return arr;
20 }
std::vector< std::string > Vectorize(const char *cstr, const char *delimiter)
Definition: vectorize.cpp:10