16,548
社区成员




CString strTemp = "12A456";
CString strNum = "123456";
//只是代码短一点,效率未必高,未进行效率比较测试。
CString strTemp = "123A23";
CString str;
sscanf(strTemp, "%[^A-Za-z]", str);
if(str.GetLength() < strTemp.GetLength())
MessageBox("含有字母");
#include <locale>
#include <iostream>
using namespace std;
int main( )
{
locale loc ( "German_Germany" );
bool result1 = isalpha ( 'L', loc);
bool result2 = isalpha ( '@', loc);
bool result3 = isalpha ( '3', loc);
if ( result1 )
cout << "The character 'L' in the locale is "
<< "alphabetic." << endl;
else
cout << "The character 'L' in the locale is "
<< " not alphabetic." << endl;
if ( result2 )
cout << "The character '@' in the locale is "
<< "alphabetic." << endl;
else
cout << "The character '@' in the locale is "
<< " not alphabetic." << endl;
if ( result3 )
cout << "The character '3' in the locale is "
<< "alphabetic." << endl;
else
cout << "The character '3' in the locale is "
<< " not alphabetic." << endl;
}