shadPS4/src/Util/StringUtil.h

26 lines
518 B
C
Raw Normal View History

2023-06-18 16:54:22 +02:00
#pragma once
#include <vector>
#include <string>
namespace StringUtil {
static std::vector<std::string> split(const std::string& s, char seperator)
{
std::vector<std::string> output;
std::string::size_type prev_pos = 0, pos = 0;
while ((pos = s.find(seperator, pos)) != std::string::npos)
{
std::string substring(s.substr(prev_pos, pos - prev_pos));
output.push_back(substring);
prev_pos = ++pos;
}
output.push_back(s.substr(prev_pos, pos - prev_pos)); // Last word
return output;
}
}