- /* Create a function that returns true if a string contains any spaces.
- */
- bool hasSpaces(std::string str) {
- // loop through each character in string, if its a space return true
- for (int i = 0;i<str.size();i++){
- if (' '==str[i]){return true;}
- }
- return false;
- }
|