Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Replace all spaces in a string in C++
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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; }
cl.exe
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 1,8 sec, absolute running time: 0,23 sec, absolute service time: 2,04 sec
fork mode
|
history
|
discussion
Behrethisandthistoo