#ifndef ZUTIL #define ZUTIL #include #include #include #include using namespace std; namespace zutil{ void tolower(string &s); void trim(string &str); vector parseLine(istream &in, char separator, char endl); vector split(const string &s, char separator); template bool remove(vector &v, const T &item){ typename vector::iterator it; it = find(v.begin(), v.end(), item); if(it != v.end()){ v.erase(it); return true; } return false; } template bool contains(const vector &v, const T &item){ typename vector::const_iterator it; it = find(v.begin(), v.end(), item); if(it != v.end()) return true; return false; } template string to_string(const T &t){ stringstream ss; ss << t; return ss.str(); } } #endif