> Jon Berndt writes:
> >
> > Does anyone know a good algorithm to take an STL string to lower case?
>
> **untested**
>

Thanks, Norman:

I finally got some time to look around. I found this web page,
http://www.msoe.edu/eecs/cese/resources/stl/string.htm with this text:

"transform:

This STL algorithm (from the <algorithm> library) is a little tricky, but simple uses 
are
easy. For example, we can iterate through the characters in a string, modifying them in
some way, and returning the modified characters back to their original positions. In 
this
case, we set the result iterator to specify the beginning of the string. A common
application is to convert a string to upper or lower case.

  string str22 = "This IS a MiXed CaSE stRINg";
  transform (str22.begin(),str22.end(), str22.begin(), tolower);
  cout << "[" << str22 << "]" << endl; //

the output is:

  [this is a mixed case string]

Note that the result iterator must specify a destination that is large enough to accept
all the modified values; here it is not a problem, since we're putting them back in the
same positions. The tolower function (along with toupper, isdigit, and other useful 
stuff)
is in the <cctype> library; for more general case conversions, take a look at the 
<locale>
library, which is beyond the scope of the present discussion."


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to