c++中不区分大小写比较字符串大小
生活随笔
收集整理的這篇文章主要介紹了
c++中不区分大小写比较字符串大小
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#include <algorithm>
using namespace std;
// string轉小寫
std::string? JGUtil::strToLower(std::string str)
{
? ? std::string strTmp = str;
? ? transform(strTmp.begin(), strTmp.end(), strTmp.begin(), towupper);
? ? return strTmp;
}
// string.compareNoCase:不區分大小寫
bool JGUtil::compareNoCase(std::string strA,const std::string strB)
{
? ? string str1 = strToLower(strA);
? ? string str2 = strToLower(strB);
? ? return (str1 == str2);
}
總結
以上是生活随笔為你收集整理的c++中不区分大小写比较字符串大小的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Winamp网页播放器
- 下一篇: 数据库mysql加密存储_数据库数据加密