String* str1;
String* str2;
String* s;
str1="Rado";
str2="Robes";
s= str1 + ' ' + str2;
But VC++ write me error> d:\My projects\Visual C++\listview\Form1.h(125):
error C2845: '+' : cannot perform pointer arithmetic on __gc pointer
'System::String __gc *'
BUT when I declare "Strings str;" It's bad too.
Where can be problem?
How can I join strings for example 7 strings and in the middle of each
string will be space?
Thanks.
mccoyn - 06 May 2004 01:26 GMT
String::Concat will join 2 strings
String* str1
String* str2
String* str3
str1 = "Hello "
str2 = "World"
str3 = String::Concat(str1, str2)
You can also use String::Format, which is similiar to sprintf, but it takes advantage of type checking in .Net
String* str1
String* str2
String* str3
str1 = "Hello"
str2 = "World"
str3 = String::Format("{0} {1}", str1, str2);