Click to See Complete Forum and Search --> : comparing std::string objects - no case


gradiov
February 7th, 2005, 09:35 PM
Hi everyone. A quick STL question here: is there any function/method defined for case-insencitive comparesent of two std::string objects and if not - what would be the C++ way to convert std::string content to upper/lower case.

I am very well aware of strupr, _tcsupr and other C fucntions that would allow me to do this but what would be the C++ way?

Thanks a lot.

gradiov
February 7th, 2005, 09:41 PM
Never mind folks. I found it:
std::transform(str.begin(), str.end(), str.begin(), toupper);
If you have other suggestions please let me know. Thanks again.

Philip Nicoletti
February 7th, 2005, 10:34 PM
see my notes for some std::string utilities ...

http://nicoletti.50megs.com/cpp_notes/string/utilities.html

gradiov
February 8th, 2005, 07:45 AM
Thanks, Philip! :-)

Yves M
February 8th, 2005, 11:20 AM
Nice collection of utilities Philip :)