bool CSFCApp::IsNum(CString str)
{
if(str=="")
return false;
if(str.GetAt(0) == '-')
str = str.Right(str.GetLength()-1);
bool bNum = false;
for(int i=0; i<str.GetLength(); i++)
{
if ((str[i] >= '0' && str[i] <= '9') || str[i] == '.')
{
bNum = true;
}
else
{
bNum = false;
return false;
}
}
if (bNum == true)
{
return true;
}
else
{
return false;
}
}
转载于:https://www.cnblogs.com/ShiShouTHS/p/11365167.html