#include <iostream>
using namespace std;
#include <regex>
regex r(R"(^^\s*[-+]?((\d+(\.\d+)?)|(\d+\.)|(\.\d+))(e[-+]?\d+)?\s*$)");
class Solution {
public:
bool isNumber(const string& s) {
return regex_match(s, r);
}
};
int main()
{
system("chcp 65001");
Solution isnuma;
if (isnuma.isNumber("10A")==true)
{ cout << "是Number" << endl;
}else{
cout << "不是Number" << endl;
}
return 0;
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询