如果我有 s1255678a 并且我使用 (Isalpha[0]!=0 && isalpha[8]!=0) return 1//判断数组0数组8是字母表 我如何使用类似的代码来确定从数组 1 到数组 7 是数字
最佳答案
我建议您使用正则表达式。 这应该为您指明正确的方向。 http://www.cplusplus.com/reference/regex/
我认为应该这样做。
string input("s1255678a");
regex pattern("[A-Za-z][0-9]{8}[A-Za-z]")
regex_match(input,pattern)
关于c++ - 如何确定用户输入的是字符串中的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38319334/