umbra/projs/shadow-utility/string-helpers.cpp
2022-05-26 23:52:01 +02:00

21 lines
396 B
C++

module;
import <string>;
import <vector>;
module shadow_utils;
inline std::vector<std::string> explode(const std::string& s, const char& c)
{
std::string buff;
std::vector<std::string> v;
for (auto n : s)
{
if (n != c) buff += n; else
if (n == c && buff != "") { v.push_back(buff); buff = ""; }
}
if (buff != "") v.push_back(buff);
return v;
}