I\'m sorry for flaming std::string and std::wstring. They are quite limited and far from being thread safe. Performance wise, they are not that good too. I miss simple features
The C++ String Algorithms Library from Boost has pretty much all of the features you need.
For conversion, you can always break down and use the C library cstdlib.
#include <cstlib>
#include <iostream>
int main()
{
std::string num;
std::cin >> num;
someFunc(atoi(num));
someOtherFunc(atof(num));
return 0;
}
atoi = ascii to integer atof = ascii to float
As for find, use the STL function "find" defined under header algorithm, or find_first_of (or similar). I also believe you can initialize a vector of char's with an std::string, but that is conjecture.
Bstring - Although I never tried it myself, the feature set and speed presented at their site. Under your choice of GPL or BSD license is also a good degree of freedom.
Also, the name suggests it's better so how can they lie? :)
The C++ String Toolkit (StrTk) Library is a free library that consists of robust, optimized and portable generic string processing algorithms and procedures for the C++ language. The library is designed to be easy to use and integrate within existing code.
The library has the following capabilities:
and plenty more...
Compatible C++ Compilers:
Source:
I found wxString convenient to use and it has many features. Although it is part of a bigger library (wxWidgets) and maybe just too big when you just want to use strings. It also works without GUI components when you just use wxBase which contains the wxString and a 'few' other components.
EDIT: here is a link to the documentation. It accepts the standard functions of std::string and also a few others. I always find the BeforeFirst() and AfterFirst() very convenient when I have to parse some text. And it is really well documented.
I'm not sure I agree. Strings really shouldn't be thread-safe due to the overhead, except for reference-counting, if applicable. Most of the other functionality you want would turn strings into a garbage barge. Likewise, removing dependencies would remove their ability to work well with streams.
The one thing I'd suggest is that we could benefit from an immutable string class, particularly one that has no memory ownership or termination. I've written those before and they can be very helpful.