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
masodijegy.cpp
Title
C++ string format
MyCodeWindows
#27
Union and possible undefined behavior
bitfields_msvc
reference
Full System Specifications version 2
Double_wrapper vc++