bool endswith(types::str const& s, types::str const& suffix, long start, long end) { if(end == -1) end = s.size(); long rstart = end - suffix.size(); return rstart >= start and s.compare(rstart, suffix.size(), suffix) == 0; }
bool startswith(types::str const &s, types::str const &prefix, long start, long end) { if (end < 0) end = s.size(); return (end - start) >= prefix.size() and s.compare(start, prefix.size(), prefix) == 0; }
bool startswith(types::str const& s, types::str const& prefix, long start=0, size_t end=std::string::npos) { if(end == std::string::npos) end = s.size(); return (end - start) >= prefix.size() and s.compare(start, prefix.size(), prefix) == 0; }