11 August 2004

String algorithms library from Boost

While I was looking to see if Boost had updated their site to include documentation for the multi-index containers, I saw that the next version will have a string algorithm library. Their site seems to be a mess now, but I found the documentation here.

Damn if it isn't everything that I had already written, but of course done so much more elegantly.

A few juicy features:

  • Case conversion (to_upper, to_lower),
  • Trimming (predicate-based),
  • Find algorithms (including token-based and regular expressions),
  • Formatting (convert to valid input: NULL-to-empty-string, etc.)

The Quick Reference section lists all of the details in grouped tables. A big plus about many of these functions is that they work on std::string and std::wstring. All of the standard library algorithms and predicates work on single characters, so you have to un-intuitively treat strings as character containers and iterate through using begin() and end(). This new Boost library smooths all of that out.

Codermonkey and I were just discussing string processing today (yeah, I know: GEEKS). He dislikes the lack of native string type in C++, although I almost have him indoctrinated into the cult of the angle brackets. I'm much more forgiving of C++ because of the language's ability to abstract away much of the difficulties, a la Boost's string library.

Ahh, but some programmers at this hypothetical company still hate template programming. One recently found the Boost library in SourceSafe and asked we're a big company: why are we using this shareware? I can only hope to be able to write "shareware" with these uber-geeks someday. They are defining the future of C++, having written books and served on the standards committees, and some hack is copping an attitude. Idiot.

[ posted by sstrader on 11 August 2004 at 11:56:35 PM in Programming ]