Search
 
SCRIPT & CODE EXAMPLE
 

CPP

how to remove spaces from a 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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ std::find with lambda 
Cpp :: cannot find "-lsqlite3" C++ 
Cpp :: check variable type c++ 
Cpp :: c ++ program to search hashmap 
Cpp :: C++ shortcuts in desktopp app 
Cpp :: copy substring to another string c++ 
Cpp :: PI IN C++ WITH CMATH 
Cpp :: c++ find sum of vector 
Cpp :: c++ print byte as bit 
Cpp :: Modulo Exponentiaon,Iteratve Modulo Exponentiation 
Cpp :: how to know in flutter if signin with user completed in firebase 
Cpp :: how to sort a vector in descending order in c++ 
Cpp :: c++ vector iterator 
Cpp :: c++ round number up 
Cpp :: c++ fibonacci 
Cpp :: c++ int to string 
Cpp :: optimized bubble sort 
Cpp :: how to run a c++ file from terminal linux 
Cpp :: convert int to binary string c++ 
Cpp :: how to string to integer in c++ 
Cpp :: chrono start time in c++ 
Cpp :: cpp unions 
Cpp :: c++ random number 0 to 1 
Cpp :: search a word in cpp file 
Cpp :: c++ random number within range 
Cpp :: primes in range cpp 
Cpp :: ray sphere intersection equation 
Cpp :: c++ cast char to string 
Cpp :: c++ get type name of object 
Cpp :: debugging c/c++ with visual studio code 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =