| 148 | } |
| 149 | |
| 150 | bool EndWith(const std::string& s, const std::string& pattern) { |
| 151 | if (s.size() < pattern.size()) { |
| 152 | return false; |
| 153 | } |
| 154 | const char* cs = &(s.back()); |
| 155 | const char* cp = &(pattern.back()); |
| 156 | for (size_t i = 0; i < pattern.size(); ++i, --cs, --cp) { |
| 157 | if ((*cs) != *(cp)) { |
| 158 | return false; |
| 159 | } |
| 160 | } |
| 161 | return true; |
| 162 | } |
| 163 | |
| 164 | std::string Join(const std::vector<std::string>& v, |
| 165 | LiteString delim, |