Determine if a string ends with a particular postfix. \param s String to check for postfix. \param postfix Postfix to search for. \return Whether the string ends with the postfix. */
| 231 | \return Whether the string ends with the postfix. |
| 232 | */ |
| 233 | inline bool endsWith(const std::string& s, const std::string& postfix) |
| 234 | { |
| 235 | if (postfix.empty()) |
| 236 | return true; |
| 237 | if (postfix.size() > s.size()) |
| 238 | return false; |
| 239 | return (strcmp(postfix.data(), |
| 240 | s.data() + s.size() - postfix.size()) == 0); |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | Generate a checksum that is the integer sum of the values of the bytes |