Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Replace all spaces in a string in C++
#include <iostream> #include <cctype> // isalpha, isspace etc #include <string> std::string trim(const std::string& entry){ std::string trimmed; for(const auto &c: entry){ if(!isspace(c)) trimmed += c; } return trimmed; } int main() { std::cout << trim("Behre \n \t this \v and this too ") << std::endl; return 0; }
run
|
edit
|
history
|
help
0
copy
calling convention is part of type(?)
Code
asock
Compile time creation of class member stl container (const std::array) filled with elements.
amusing overload choice
std override
hangman
accessibility on in-class typedefs
Problem_onoff_3