如何对一个字符串进行判断(大小写不区分),在线等待! 如判断一个字符串是不是“admin",但字符号串里面的大小写不区分,即里面也可以是”ADMIN“,也可以是“Admin",应该怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 strcmpi(...)or CString::CompareNoCase(...) // example for CString::CompareNoCaseCString s1( "abc" );CString s2( "ABD" );ASSERT( s1.CompareNoCase( s2 ) == -1 ); // Compare with a CString.ASSERT( s1.Compare( "ABE" ) == -1 ); // Compare with LPTSTR string. char cA[]="admin";for(int i=0;i<sizeof(cA)-1;i++){ if(cA[i]<='a')cA[i]=cA[i]-'A'+'a';}以上是去掉cA[]中的大写字母。 Compare characters of two strings without regard to case.int _strnicmp( const char *string1, const char *string2, size_t count ); CString str1( "aDmIN" );CString str2;if( str1.MakeUpper() == "ADMIN" ) str2 = "a";else str2 = "b"; 如何获取垂直滚动条的高度? 如何CBitmapButton类的按钮响应mousemove(当鼠标进入按钮区域时按钮的图片改变 人民币 求购源程序 如何判断一个端口是否支持obex功能 关于CDC拷贝的问题; 最简单的---初学者问题! 请问怎样将一个弹出的菜单收回去呢?我发送了WM_UNINITMENUPOPUP消息,好象没用 VC内存泄漏问题好严重啊! 可执行文件格式? 如何隐藏CHtmlView类中滚动条 再问一个小问题WM_INITDILALOG和WM_COMMAND是什么意思?都是怎么用? 不知csdn還許不許放分,suping進來接分,多謝你的耐心解答!
CString s1( "abc" );
CString s2( "ABD" );
ASSERT( s1.CompareNoCase( s2 ) == -1 ); // Compare with a CString.
ASSERT( s1.Compare( "ABE" ) == -1 ); // Compare with LPTSTR string.
for(int i=0;i<sizeof(cA)-1;i++)
{
if(cA[i]<='a')cA[i]=cA[i]-'A'+'a';
}
以上是去掉cA[]中的大写字母。
CString str2;
if( str1.MakeUpper() == "ADMIN" )
str2 = "a";
else
str2 = "b";