📌  相关文章
📜  c++98 检查字符是否为整数 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:46.892000             🧑  作者: Mango

代码示例1
std::string s = "1234798797";
std::istringstream iss(s);

int num = 0;

if (!(iss >> num).fail()) {
    std::cout << num << std::endl;
}
else {
    std::cerr << "There was a problem converting the string to an integer!" << std::endl;
}