30 #ifndef RIOENGINE_MISC_STRINGHELPER_H_
31 #define RIOENGINE_MISC_STRINGHELPER_H_
43 static std::vector<std::string>
split(
const std::string& str,
const std::string& delimiters) {
44 std::vector<std::string> tokens;
47 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
49 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
51 while (std::string::npos != pos || std::string::npos != lastPos) {
53 tokens.push_back(str.substr(lastPos, pos - lastPos));
55 lastPos = str.find_first_not_of(delimiters, pos);
57 pos = str.find_first_of(delimiters, lastPos);
64 static std::string
addPrefix(
const std::string& prefix,
const std::string& str) {
65 std::string result = prefix;
73 std::string::size_type i = original_str.find(str_to_remove);
75 if (i != std::string::npos) {
76 original_str.erase(i, str_to_remove.length());
84 std::string str_to_remove = std::string(&char_to_remove);
89 #endif // RIOENGINE_MISC_STRINGHELPER_H_
static std::string & removeOccurrencesOfString(std::string &original_str, std::string &str_to_remove)
static std::string & removeOccurrencesOfChar(std::string &original_str, char char_to_remove)
static std::string addPrefix(const std::string &prefix, const std::string &str)
static std::vector< std::string > split(const std::string &str, const std::string &delimiters)