Browse - programming tips - is a std string all spaceDate: 2008jun27 Language: C/C++ Q. What's the best way to check of a std::string is all space characters? A. This function does the trick: static const char *szSpaceChars = " \t\r\n"; bool is_std_string_all_space(const std::string &str) { if (str.empty()) return true; return str.find_first_not_of(szSpaceChars) == std::string::npos; }
Add a commentSign in to add a comment |