c++判断一个字符串是否是数字

时间:2023-03-08 21:36:28
bool isNum(const string& str)
{
    bool bRet = false;
    bool point = false;
    )
    {
        return bRet;
    }

    ]) && str[] != ] != '-' )
    {
        return bRet;
    }

    ] == ] == ] == '-'))
    {
        return bRet;
    }

    ; i < str.length(); i++ )
    {
        if (!isdigit(str[i]))
        {
            if (str[i] == '.' && !point)
            {
                point = true;
            } else
            {
                return bRet;
            }

        }
    }

    return true;
}