Files
cpp-utils/String.h
2026-01-24 16:10:02 -05:00

21 lines
453 B
C++

#ifndef STRING_H
#define STRING_H
#include <sstream>
#include <string>
#include <vector>
// Split a string on a delimiter to a vector of strings
inline std::vector<std::string> split(const std::string &str, const char delimiter) {
std::vector<std::string> result;
std::stringstream ss(str);
std::string token;
while (std::getline(ss, token, delimiter)) {
result.push_back(token);
}
return result;
}
#endif //STRING_H