判断一个字符串中是否含有非数字字符和是否含有字母字符?

   CString m="2%*  323  23";

int i = 0;
while(i < m.GetLength()-1)
{
   if(isdigit(m.GetAt(i)) ==0)    //isalpha()函数是判断是否有字母的函数。
{
   MessageBox("不是数字");
}
else
{
MessageBox("是数字");
}
i++;
}

posted on 2006-06-23 17:46  路吾  阅读(2212)  评论(0)    收藏  举报

导航