/***
*判断一个字符串是否为纯数字
*/
int Common::isDigitStr(QString src)
{
QByteArray ba = src.toLatin1();//QString 转换为 char*
const char *s = ba.data();
while(*s && *s>='0' && *s<='9') s++;
if (*s)
{ //不是纯数字
return -1;
}
else
{ //纯数字
return 0;
}
}
Qt判断QString中的字符串是否为纯数字
最新推荐文章于 2024-05-13 17:54:15 发布