How could one convert a string to upper case. The examples I have found from googling only have to deal with chars.
Boost string algorithms:
#include <boost/algorithm/string.hpp> #include <string> std::string str = "Hello World"; boost::to_upper(str); std::string newstr = boost::to_upper_copy<std::string>("Hello World");
Binary Oct Dec Hex Abbr Unicode Control char C Escape code Name 0000000 000 0 00 NUL ? ^@ Null character
There's no difference, but the more idiomatic one is
Putting it down as
char c = 0; could mean that you intend to use it as a number (e.g. a counter).
' ' is unambiguous.
Ruby has a few methods for changing the case of strings. To convert to lowercase, use
"hello James!".downcase #=> "hello james!"
upcase capitalizes every letter and
capitalize capitalizes the first letter of the string but lowercases the rest:
"hello James!".upcase #=> "HELLO JAMES!" "hello James!".capitalize #=> "Hello james!" "hello James!".titleize #=> "Hello James!"
If you want to modify a string in place, you can add an exclamation point to any of those methods:
string = "hello James!" string.downcase! string #=> "hello james!"
Refer to the documentation for String for more information.
Apart from what you're doing is probably best done with XML APIs instead of strings or StringBuilder I doubt that the error you see is due to string concatenation. Maybe switching to StringBuilder just masked the error or went over it gracefully, but I doubt using strings really was the cause.
You're doing cout right? So obviously it gets displayed.
Maybe what you are trying to do is some code injection in a running process like this http://www.codeproject.com/KB/DLL/code_injection.aspx