| |
 | Using the Transform() Algorithm to Change a String's Case
By Danny Kalev, C++ Pro
|
Command line interpreters, HTTP requests, and SMS messages are only a few of the applications in which different letter cases merely cause noise. To overcome this problem, such applications usually convert all strings to uppercase before any further processing.

Sadly, most of these apps use C-style strings and ad-hoc, in-house conversion routines that more often than not suffer from bugs, illegibility, and performance overhead. The std::string class provides more than a hundred member functions and overloaded operators. Yet, none of these functions transforms a string to uppercase or lowercase letters.

Use the STL transform() algorithm to change a string's case easily.
|
|
Find Out More
SGI: The Standard Template Library
DevX TechTip: Understanding Iterator Categories
DevX TechTip: Invoking a Function Through a Pointer
C++ 10-Minute Solution: Defining a Function Object
DevX TechTip: Overloading the Function Call Operator
DevX C++ Zone
All DevX 10-Minute Solutions for C/C++
 | TALK BACK |
In the early days of the object-oriented revolution, code reuse was touted as one of the major benefits of this paradigm. Based on your experience, has this promise been fulfilled?
 |
|