12 size_t start = s.find_first_not_of(
WHITESPACE);
13 return (start == std::string::npos) ?
"" : s.substr(start);
20 return (end == std::string::npos) ?
"" : s.substr(0, end + 1);
31 const std::string& delim )
33 constexpr size_t NPOS = std::string::npos;
34 std::vector<std::string> output;
36 std::string remainder = input;
37 size_t first_scope = remainder.find_first_of(delim);
39 while (first_scope != NPOS)
41 if (first_scope != 0) output.push_back(remainder.substr(0, first_scope));
43 remainder = remainder.substr(first_scope + delim.size(), NPOS);
44 first_scope = remainder.find_first_of(delim);
46 output.push_back(remainder);
53 const std::string& search_string)
55 constexpr size_t NPOS = std::string::npos;
56 std::string output = input;
57 const size_t last_scope = input.find_last_of(search_string);
58 if (last_scope != NPOS)
59 output = input.substr(last_scope + search_string.size(), NPOS);
66 std::ifstream file(file_name.c_str(), std::ifstream::in);
69 "Failed to open file \"" + file_name +
71 "Either the file does not exist or you do not have read permissions.");
#define ChiLogicalErrorIf(condition, message)
std::string StringUpToFirstReverse(const std::string &input, const std::string &search_string)
const std::string WHITESPACE
void AssertReadibleFile(const std::string &file_name)
std::string StringLTrim(const std::string &s)
std::vector< std::string > StringSplit(const std::string &input, const std::string &delim)
std::string StringRTrim(const std::string &s)
std::string StringTrim(const std::string &s)