I have been doing a little managed C++ at work the last couple of days. Did you know you could do this:
System::String^ str = gcnew System::String("");
str += 5;
System::Console::WriteLine(str); // prints: 5
or simply:
System::String^ str = "";
str += 5;
System::Console::WriteLine(str); // prints: 5
or even:
System::String^ str;
str += 5;
System::Console::WriteLine(str); // prints: 5
The 5 is converted to a String for you. After working with C++ for so many years without a simple way to convert an int to a string this is nice. Might not seem like that big a deal, but these little things add up.
5 comments:
Just started C++ today, and already I owe you one
Nice and concise, best solution I've seen so far.
Totally good!
thx a bunch man! been looking for a simple solution like this for so long
Thank u that was simple and good.
Post a Comment