c++ - How to check number is available in CString - Visual MFC -
there edit control (type: cstring) in program. how check if control contains number? (ex: "abcdef4hg", "xxxyyy12"....)
just try check if there digit in string or not. can use std::isdigit
.
#include <cctype> bool hasdigits(const cstring &str) { for(int = 0; < str.getlength(); i++) { if(std::isdigit(str[i])) return true; } return false; }
Comments
Post a Comment