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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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