C++ check if string is space or null

后端 未结 6 1296
死守一世寂寞
死守一世寂寞 2021-01-13 04:38

Basically I have string of whitespace \" \" or blocks of whitespace or \"\" empty in some of the lines of the files and I would

6条回答
  •  遥遥无期
    2021-01-13 05:23

    bool isWhitespace(std::string s){
        for(int index = 0; index < s.length(); index++){
            if(!std::isspace(s[index]))
                return false;
        }
        return true;
    }
    

提交回复
热议问题