#include "utils.hpp" std::vector split(std::string input, char delimiter) { std::vector answer; std::stringstream ss(input); std::string temp; while (getline(ss, temp, delimiter)) answer.push_back(temp); return answer; } std::string trim(std::string str, char c) { str = str.substr(str.find_first_not_of(c)); str = str.substr(0, str.find_last_not_of(c) + 1); return str; } std::string itos(int n) { std::stringstream strs; strs << n; return ( strs.str() ); } bool isNumeric(std::string str) { for (size_t i = 0; i < str.length(); i++) { if (std::isdigit(str[i]) == false) return false; } return true; } bool isNumeric_btw(int low, int high, std::string str) { for (size_t i = 0; i < str.length(); i++) { if (std::isdigit(str[i]) == false) return false; } int n = std::atoi(str.c_str()); if (n < low || n > high) return false; return true; }