Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ remove whitespace from string

#include <algorithm>

int main()
{
    std::string str = "H e l l o";
    str.erase(remove(str.begin(), str.end(), ' '), str.end());
    std::cout << str; // Output Hello
    
    return 0;
}
 
PREVIOUS NEXT
Tagged: #remove #whitespace #string
ADD COMMENT
Topic
Name
2+9 =