void Test(void)
{
CString str=_T("0001afeafea가나다미다미eaeafedf12131213가나다.aaa");

int digitcount=0;
int engcount=0;
int korcount=0;
int korcount2=0;
CString digit;
CString eng;
CString kor1;
CString kor2;

for(int i=0; i<str.GetLength(); i++)
{
TCHAR ch = str.GetAt(i);
if(IsDBCSLeadByte(str.GetAt(i))) //str[i]))
{
korcount++;
kor1.AppendChar(str.GetAt(i));
}
else
{
if(isdigit(str.GetAt(i)))
{
digitcount++;
digit.AppendChar(str.GetAt(i));
}
if(isalpha(str.GetAt(i)))
{
engcount++;
eng.AppendChar(str.GetAt(i));
}
}
if (0 >= str.GetAt(i) || 127 < str.GetAt(i))
{
korcount2++;
kor2.AppendChar(str.GetAt(i));
}
}
CString aaa;
aaa.Format(_T("%d, %d, %d, %d"), digitcount, engcount, korcount, korcount2);
aaa += _T("/ digit:")+digit+_T("eng:")+eng+_T("kor1:")+kor1+_T("kor2:")+kor2;
AfxMessageBox(aaa);
}

'programmer > mfc' 카테고리의 다른 글

Visual Studio 2008 <-> 2005 호환 문제  (0) 2011.08.19

+ Recent posts