8 // Like boost, but ASCII only. Only C locale required.
10 inline bool iequal_char(char a
, char b
)
12 return std::toupper(static_cast<unsigned char>(a
)) ==
13 std::toupper(static_cast<unsigned char>(b
));
16 inline bool iequal(std::string_view a
, std::string_view b
)
18 return (size(a
) == size(b
)) &&
19 std::equal(begin(b
), end(b
), begin(a
), iequal_char
);
22 inline bool iless_char(char a
, char b
)
24 return std::toupper(static_cast<unsigned char>(a
)) <
25 std::toupper(static_cast<unsigned char>(b
));
28 inline bool iless(std::string_view a
, std::string_view b
)
30 return std::lexicographical_compare(begin(a
), end(a
), begin(b
), end(b
),
34 inline bool istarts_with(std::string_view str
, std::string_view prefix
)
36 return (str
.size() >= prefix
.size()) &&
37 iequal(str
.substr(0, prefix
.size()), prefix
);
40 inline bool iends_with(std::string_view str
, std::string_view suffix
)
42 return (str
.size() >= suffix
.size()) &&
43 iequal(str
.substr(str
.size() - suffix
.size(), str
.size()), suffix
);
47 bool operator()(std::string_view a
, std::string_view b
) const
53 // Ahh, the olden days of loops and pointers...
55 // inline bool iequal(char const* a, char const* b)
60 // if (!iequal_char(*a, *b))
69 #endif // IEQUAL_DOT_HPP