Esempio n. 1
0
 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;
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
 }