字串比對不分大小寫
1: namespace StringPlus
2: {
3: /// Compare chars regardless of case.
4: bool CmpCharIgnoreCase(char cA, char cB)
5: {
6: return tolower(cA)==tolower(cB);
7: }
8:
9: /// Compare strings regardless of case.
10: bool CmpStrIgnoreCase(const std::string& szA, const std::string& szB)
11: {
12: if(szA.size()!=szB.size()) return false;
13: return std::equal(szA.begin(), szA.end(), szB.begin(),CmpCharIgnoreCase);
14: }
15: }