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

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -