int StrCaseCmp(const string & stra , const string & strb)
{
int aLen = stra.length();
int bLen = strb.length();
int iRes = 0 , iPos = 0;
for (iPos = 0; iPos < aLen && iPos < bLen; ++iPos)
{
iRes = toupper(stra[iPos]) - toupper(strb[iPos]);
if (!iRes)return iRes;
}
if (iPos == aLen && iPos == bLen)return 0;
if (iPos < aLen) return 1;
if (iPos < bLen) return -1;
}
cpp不区分大小写比较字符串string
最新推荐文章于 2022-07-21 20:46:15 发布