upper or lower case?

upper or lower case?

Post by UmVlc2 » Wed, 03 May 2006 17:34:02


I have std:string. I want to convert string content to Upper or lower
depending on the situation. Which method of string supports to convert upper
or lower?

how do I do left & right trim using std::string?

like CString strobj = "Hi this is Reesh";


upper or lower case?

Post by Ulrich Eck » Wed, 03 May 2006 17:51:46

None. The C++ string class only holds characters, they don't interpret them
in any way. What you want is encapsulated in the locales instead, see the
ctype facet or the functions toupper/tolower.

Again, the ctype facet is of use there, as it can tell you if something is
whitespace or not. I think there are also libraries out there that extend
strings/locales with such commonly used functions.



upper or lower case?

Post by Jeff » Wed, 03 May 2006 21:22:13

See http://www.yqcomputer.com/

Header <boost/algorithm/string/case_conv.hpp>
Header <boost/algorithm/string/trim.hpp>

using namespace boost::algorithm;

std::string lstring();

trim_left( lstring );
to_lower( lstring );

Jeff Flinn

upper or lower case?

Post by UmVlc2 » Thu, 04 May 2006 16:26:02

Thank you very much.