3 ms·
In C++ you can implement it in a way that gives you much more control. Do you want to truncate the string? return new strings? return string views? It all depe
by 29athrowaway 6y ago
In C++ you can implement it in a way that gives you much more control.
Do you want to truncate the string? return new strings? return string views? It all depends what you need.
In some languages all strings are immutable and all operations result in new strings and you have no control over that.
- mehrdadn 6y agoThe trouble is often it doesn't matter and literally any of those would be useful, and yet none of them exists for you to use, so you have to waste time reinventing the wheel.
- 29athrowaway 6y agoPerhaps they're not in the standard library, but they're readily available on Boost, POCO and many other well known mature libraries. Check the Boost C++ string algorithms library. https://www.boost.org/doc/libs/1_74_0/doc/html/string_algo/usage.html#id-1.3.3.5.9 https://www.boost.org/doc/libs/1_74_0/doc/html/string_algo/u...