Ask HN: Why on God's beautiful Earth does std::string not have a trim()? - hellofunk
======
coreyp_1
Now, now... we don't want it to look too much like those silly scripting
languages, do we?

(Serious answer: I have no idea, and despite having written a lot of C++ over
the years, I've actually never needed to use a trim(), so I never noticed that
it was missing! I learned something new in the middle of my insomnia!)

~~~
hellofunk
I use it all the time in other languages like Clojure, and now needing to use
it in C++ I am finding that lots of people have their own implementations for
it laying around. Just look at all the ad-hoc trim()s on stackoverflow.
Ridiculous. Such a basic string feature, yet std can't provide it for reasons
unknown.

~~~
coreyp_1
[http://www.cplusplus.com/forum/general/115700/](http://www.cplusplus.com/forum/general/115700/)

Here is a good "explanation" as to why, and I suppose it's as good as any
other. The forum post does recommend using boost, though, which is a common
c++ staple.

