cmpsc330hw4/utils.cxx

13 lines
312 B
C++
Raw Normal View History

2024-11-20 03:34:14 +00:00
#include <string>
2024-11-20 01:04:51 +00:00
char toLowerCase(const char c) {
return c | 32;
}
2024-11-20 03:34:14 +00:00
bool equalsIgnoreCase(const std::string &a, const std::string &b) {
if (a.size() != b.size()) return false;
for (size_t i = 0; i < a.size(); ++i) {
if (tolower(a[i]) != tolower(b[i])) return false;
}
return true;
}