Answers for "c++ check string is white space"

C++
0

c++ check string is white space

#include <cctype>
#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    char str[] = "<html>\n<head>\n\t<title>C++</title>\n</head>\n</html>";

    cout << "Before removing whitespace characters" << endl;
    cout << str << endl << endl;

    cout << "After removing whitespace characters" << endl;
    for (int i=0; i<strlen(str); i++)
    {
        if (!isspace(str[i]))
            cout << str[i];
    }
    
    return 0;
}
Posted by: Guest on October-04-2021

Browse Popular Code Answers by Language