| 104 | } |
| 105 | |
| 106 | static bool EndsWith(const std::string& s, const char* suffix, size_t suffix_length, |
| 107 | bool case_sensitive) { |
| 108 | size_t string_length = s.size(); |
| 109 | if (suffix_length > string_length) { |
| 110 | return false; |
| 111 | } |
| 112 | size_t offset = string_length - suffix_length; |
| 113 | return (case_sensitive ? strncmp : strncasecmp)(s.c_str() + offset, suffix, suffix_length) == 0; |
| 114 | } |
| 115 | |
| 116 | bool EndsWith(const std::string& s, const char* suffix) { |
| 117 | return EndsWith(s, suffix, strlen(suffix), true); |
no test coverage detected