Asked  7 Months ago    Answers:  5   Viewed   32 times

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";


std::string newstr = boost::to_upper_copy<std::string>("Hello World");
Tuesday, June 1, 2021
answered 7 Months ago

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.

Tuesday, June 22, 2021
answered 6 Months ago

Ruby has a few methods for changing the case of strings. To convert to lowercase, use downcase:

"hello James!".downcase    #=> "hello james!"

Similarly, 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   #=> "hello james!"

Refer to the documentation for String for more information.

Tuesday, July 27, 2021
answered 5 Months ago

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.

Friday, August 6, 2021
answered 4 Months ago

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

Saturday, August 21, 2021
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :