22 bool ends_with(
const char* str,
const char* match) {
23 size_t str_size = 0, match_size = 0;
27 ++match, ++match_size;
28 if (match_size > str_size)
31 while (match_size != 0) {
32 --str, --match, --match_size;
33 if (*str != *match)
return false;
38 bool ends_with(
const char* str,
const std::string& match) {
39 size_t str_size = 0, match_size = match.size();
42 if (match_size > str_size)
45 std::string::const_iterator m = match.end();
46 while (m != match.begin()) {
48 if (*str != *m)
return false;
53 bool ends_with(
const std::string& str,
const char* match) {
54 size_t str_size = str.size(), match_size = strlen(match);
55 if (match_size > str_size)
58 std::string::const_iterator s = str.end() - match_size;
60 if (*s != *match)
return false;
66 bool ends_with(
const std::string& str,
const std::string& match) {
67 if (match.size() > str.size())
70 return std::equal(match.begin(), match.end(), str.end() - match.size());
76 size_t str_size = 0, match_size = 0;
80 ++match, ++match_size;
81 if (match_size > str_size)
84 while (match_size != 0) {
85 --str, --match, --match_size;
92 size_t str_size = 0, match_size = match.size();
95 if (match_size > str_size)
98 std::string::const_iterator m = match.end();
99 while (m != match.begin()) {
107 size_t str_size = str.size(), match_size = strlen(match);
108 if (match_size > str_size)
111 std::string::const_iterator s = str.end() - match_size;
112 while (*match != 0) {
120 if (match.size() > str.size())
123 return std::equal(match.begin(), match.end(), str.end() - match.size(),
124 [](
const char& c1,
const char& c2) {
char to_lower(char ch)
Transform the given character to lower case without any localization.
bool ends_with_icase(const char *str, const char *match)
bool ends_with(const char *str, const char *match)
Checks if the given match string is located at the end of this string.